The discussion revolves around mapping Discourse upload short-urls (e.g., upload://fkO7C9M7SLRhXjEiFTOSUJIdCgJ.jpeg) to their full URLs (e.g., //127.0.0.1:4200/uploads/default/original/1X/abcafdf0e1d9262d515075420e4d940718796a5d.jpeg). david explains that both URLs contain the same SHA1 hash, with the short-url using a base62 encoding for brevity, while the full URL uses the original hex-encoded version. The process involves retrieving the SHA1 from either the short or long URL and querying the database via Upload.find_by(sha1: sha1). merefield clarifies that upload.short_url and upload.url can be used directly in Rails to generate the respective URLs, and thanks david for the explanation. The conversation references specific methods in the Discourse codebase, including Upload.sha1_from_long_url, Upload.sha1_from_short_url, and the short_url method.
Yeah, the both the short-url and the regular URL include the SHA1.
The difference is that the long URL uses the original hex-encoded version, which matches the one in the database. The upload:// “short url” is a base62 representation of the same hash, so that it uses fewer characters.