Add /dynamic segment to thumbnail route to prevent conflicts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
root
2026-01-28 23:28:06 +00:00
parent 949cc17b0d
commit b8a454bca0
5 changed files with 78 additions and 9 deletions

View File

@@ -0,0 +1,69 @@
Thumbnail URL Route Changes
Date: 2026-01-28
SUMMARY
Both thumbnail routes now include a literal path segment to prevent route
matching conflicts. If you manually construct thumbnail URLs (rather than
using get_thumbnail_url() or get_thumbnail_url_preset()), update them.
- Preset: /_thumbnail/preset/{key}/{preset_name} (unchanged from earlier today)
- Dynamic: /_thumbnail/dynamic/{key}/{type}/{width}/{height} (NEW)
AFFECTED FILES
/rsx/app/dev/attachments/dev_attachments.js
/rsx/theme/components/inputs/photo/profile_photo_input.js
Any custom code manually constructing thumbnail URLs.
CHANGES REQUIRED
If you manually construct dynamic thumbnail URLs, add "dynamic" segment:
Before:
`/_thumbnail/${key}/cover/300/200`
`/_thumbnail/${key}/fit/400`
After:
`/_thumbnail/dynamic/${key}/cover/300/200`
`/_thumbnail/dynamic/${key}/fit/400`
File: /rsx/app/dev/attachments/dev_attachments.js
-------------------------------------------------------------------------
Find:
$('#thumb-profile').attr('src', `/_thumbnail/${key}/cover/96/96`);
$('#thumb-200').attr('src', `/_thumbnail/${key}/cover/200/200`);
$('#thumb-240x180').attr('src', `/_thumbnail/${key}/cover/240/180`);
Replace with:
$('#thumb-profile').attr('src', `/_thumbnail/dynamic/${key}/cover/96/96`);
$('#thumb-200').attr('src', `/_thumbnail/dynamic/${key}/cover/200/200`);
$('#thumb-240x180').attr('src', `/_thumbnail/dynamic/${key}/cover/240/180`);
File: /rsx/theme/components/inputs/photo/profile_photo_input.js
-------------------------------------------------------------------------
Find:
this.state.thumbnail_url = `/_thumbnail/${this.state.attachment_key}/cover/${width}/${height}`;
Replace with:
this.state.thumbnail_url = `/_thumbnail/dynamic/${this.state.attachment_key}/cover/${width}/${height}`;
RECOMMENDED APPROACH
Instead of manually constructing URLs, use the model methods which always
generate correct URLs:
PHP:
$attachment->get_thumbnail_url('cover', 300, 200);
$attachment->get_thumbnail_url_preset('profile');
JavaScript (via Ajax stub):
const url = await File_Attachment_Model.get_thumbnail_url(key, 'cover', 300, 200);
VERIFICATION
1. Search your codebase for manual thumbnail URL construction:
grep -r "/_thumbnail/" rsx/ --include="*.js" --include="*.php"
2. Update any matches that don't use get_thumbnail_url methods
3. Test thumbnail display in your application