Repository navigation
Conversation
The Files list used the stored url from the *.files endpoints. Uploads made before server 9.0 keep a /ufs/... url, and that route is removed there (RocketChat/Rocket.Chat#41054), so older files rendered as broken images and dead links. Build /file-upload/{id}/{name} instead, the route every supported server serves.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📜 Recent review details
WalkthroughThe helper now builds file URLs from each file’s ID and encoded name. Tests cover image, audio, video, and other-file results, including filenames with reserved characters and non-ASCII characters. ChangesFile upload URL construction
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested labels: Merge Risk: ⚪ Minimal · up to
|
Proposed changes
The Files list (
channels|groups|im.files) passed each record's storedurlstraight into the attachment. Uploads made before server 9.0 keep a/ufs/...url, and RocketChat/Rocket.Chat#41054 removes that route without migrating stored urls, so older files show as broken images and dead links.getFileUrlAndTypeFromMessagenow builds/file-upload/{_id}/{encodeURIComponent(name)}from the record and ignores the stored url. This is the same route web's file list now uses, and every supported server serves it, so there is no version gate.E2E files read the same record:
Encryption.decryptFilesoverwritesname/typewith the decrypted values before the url is built, so the id and name are valid either way.Issue(s)
https://rocketchat.atlassian.net/browse/NATIVE-1755
How to test or reproduce
#or non-ASCII characters).urlat a path that 404s, e.g./ufs/GridFS:Uploads/<id>-gone/<name>onrocketchat_uploads.develop: images spin forever, audio stays at00:00.Tested on an Android emulator against server 8.10 (local) and 8.4 (mobile.qa). Not tested on a 9.0 server or a 3.x workspace; in the 3.0.0 server source the
/file-upload/handler looks the file up by id only.In an encrypted room the image in the Files list stays on a loading spinner on
developas well (checked with the record's original, working url), so that is separate from this change.Screenshots
/ufsurl), cache cleared/file-uploadurl)/file-uploadblocked, served from the cache)9.0 behaviour is simulated on a local 8.10 server:
/ufsanswers like a removed route and the records use the 9.0 url shape. Android emulator, throwaway account. Rows 2 and 3 already work on develop (the stored url is valid, and the cached files are found); they are here to show no regression.Types of changes
Checklist
Further comments
Unit tests cover all four attachment types, a legacy
/ufsstored url being ignored, a missing url, and name encoding (space,#,?,%,/, non-ASCII).After upgrading the app from a
developrelease build to this branch's release build (Android emulator, local 8.10 workspace, app data kept), the files in the Files list are still visible and everything looks good.Summary by CodeRabbit