Looking up and generating upload short-urls

Where are you doing this? In the Rails app?

If so, then you can generate the URLs using upload.short_url and upload.url.

To find an upload record in the first place, you can do:

sha1 = Upload.sha1_from_long_url(...)
# or
sha1 = Upload.sha1_from_short_url(...)

# then

upload = Upload.find_by(sha1: sha1)
1 Like