René's URL Explorer Experiment


Title: fix(files): serve mothership chat attachments stored under a workspace key by icecrasher321 · Pull Request #6789 · simstudioai/sim · GitHub

Open Graph Title: fix(files): serve mothership chat attachments stored under a workspace key by icecrasher321 · Pull Request #6789 · simstudioai/sim

X Title: fix(files): serve mothership chat attachments stored under a workspace key by icecrasher321 · Pull Request #6789 · simstudioai/sim

Description: Summary Chat attachment thumbnails and click-throughs were 404ing with {"error":"FileNotFoundError","message":"File not found"}. A mothership attachment is minted with the same key shape as a workspace file (resolveUploadStorage calls generateWorkspaceFileKey for mothership_attachment) but its row carries context = 'mothership', so the serve route's key-prefix branch sent it into the workspace-file use case, which matches on context = 'workspace' and resolved it to nothing. Regressed in #6654. Serve resolves the storage context from the key's stored binding (resolveStoredFileContext) rather than the prefix alone, and threads it into the cloud/local handlers instead of re-inferring. Genuine workspace files still go through the authorized use case. Fixes previews in chat history, restored drafts, queued messages, and HEIC at upload time — all build the same serve URL. A freshly picked PNG still previewed because that thumbnail is a local blob URL, which is why this looked partial. Second commit states the contract the fix depends on, so the next reader doesn't re-derive module ownership from the prefix: Prefix = bucket + tenancy. Row = module owner. workspace_files.context is server-authored like the key, but unlike the key it is mutable — materialize_file promotes an attachment to a workspace file by flipping that column. Encoding a mutable fact in an immutable key would mean copying the bytes on every transition just to restate them, which is why the prefix can't own this and executeSave stays a metadata-only flip. resolveTrustedFileContext claimed the prefix was flatly "authoritative" — the claim that made routing on it look safe. Now scoped to what it actually defends: a caller-supplied context still can never relabel a private key. resolveStoredFileContext is documented as the sanctioned reader, not a workaround. verifyWorkspaceFileAccess filtered its binding lookup to context = 'workspace', so attachments missed the row and fell through to object metadata, which can't see a soft delete. It now matches either workspace-scoped context — which is what callers already wanted, since the LLM-attachment and presigned-URL paths pass 'workspace' for attachment keys today. A soft-deleted attachment is now denied on all of them. The parse route carried the same gate, labelling parsed attachments with the raw storage segment instead of the uploaded filename. Module-scoped filters are deliberately untouched: the Files module, folder manager, forking and the workspace-file use cases match context = 'workspace' because they mean the Files module, not the bucket. Type of Change Bug fix Testing Both regressions are pinned by tests that fail against the pre-fix code, and in both cases the reason they shipped green was a mock asserting something the real function never does: The serve tests mocked inferContextFromKey to return 'mothership' for a workspace/… key. Made honest — 9 of them fail against the old route. The new authorization tests use a getFileMetadataByKey mock that honors the context/includeDeleted arguments, so they actually exercise the filter. 2 fail against the old authorizer; the workspace-context cases still pass, showing no Files-module regression. bun run test app/api/files lib/uploads lib/workspace-files — 861 pass (77 files). type-check, lint, and all 29 audits clean. Not exercised against a running app. Checklist Code follows project style guidelines Self-reviewed my changes Tests added/updated and passing No new warnings introduced I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

Open Graph Description: Summary Chat attachment thumbnails and click-throughs were 404ing with {"error":"FileNotFoundError","message":"File not found"}. A mothership attachment is ...

X Description: Summary Chat attachment thumbnails and click-throughs were 404ing with {"error":"FileNotFoundError","message":"File not found&quo...

Opengraph URL: https://github.com/simstudioai/sim/pull/6789

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:71807f05-9673-bb3b-24a1-0bccaad809cf
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idDE58:BB648:B113A8:F2D1DB:6AFB516B
html-safe-nonce45d209bdd8e8816bc4f7581380b0d805212137ab0edc1d9b40bebbe872084fe2
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERTU4OkJCNjQ4OkIxMTNBODpGMkQxREI6NkFGQjUxNkIiLCJ2aXNpdG9yX2lkIjoiMTM0MzM4Mjg2NjIyOTk0MDU4NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac02814350cda5e03d0423c042d9391c31ad345e88158d56ea60d50dd0f4348768
hovercard-subject-tagpull_request:4299828166
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/simstudioai/sim/pull/6789/files
twitter:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/17950982?s=400&v=4
og:image:altSummary Chat attachment thumbnails and click-throughs were 404ing with {"error":"FileNotFoundError","message":"File not found"}. A mothership attachment is ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
None7122bb414b542dba14d71a3f0b9f6fd2abce715b9f5912d082800563e6c806d1
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/simstudioai/sim git https://github.com/simstudioai/sim.git
octolytics-dimension-user_id199344406
octolytics-dimension-user_loginsimstudioai
octolytics-dimension-repository_id912559512
octolytics-dimension-repository_nwosimstudioai/sim
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id912559512
octolytics-dimension-repository_network_root_nwosimstudioai/sim
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecbf66c024bb6d10e6955baa7413c54cf13a201bb
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/simstudioai/sim/pull/6789/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6789%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fsimstudioai%2Fsim%2Fpull%2F6789%2Ffiles
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=simstudioai%2Fsim
Reloadhttps://github.com/simstudioai/sim/pull/6789/files
Reloadhttps://github.com/simstudioai/sim/pull/6789/files
Reloadhttps://github.com/simstudioai/sim/pull/6789/files
simstudioaihttps://github.com/simstudioai
simhttps://github.com/simstudioai/sim
Codehttps://github.com/simstudioai/sim
Issues129 (129)https://github.com/simstudioai/sim/issues
Pull requests197 (197)https://github.com/simstudioai/sim/pulls
Actionshttps://github.com/simstudioai/sim/actions
Projectshttps://github.com/simstudioai/sim/projects
Security and qualityhttps://github.com/simstudioai/sim/security
Insightshttps://github.com/simstudioai/sim/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fsimstudioai%2Fsim%2Fissues%2Fnew%2Fchoose
waleedlatif1https://github.com/waleedlatif1
staginghttps://github.com/simstudioai/sim/tree/staging
fix/mothership-attachment-servehttps://github.com/simstudioai/sim/tree/fix/mothership-attachment-serve
Conversation 3 https://github.com/simstudioai/sim/pull/6789
Commits 1 https://github.com/simstudioai/sim/pull/6789/commits
Checks 31 https://github.com/simstudioai/sim/pull/6789/checks
Files changed https://github.com/simstudioai/sim/pull/6789/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6789/files
fix(files): serve mothership chat attachments stored under a workspace key https://github.com/simstudioai/sim/pull/6789/files#top
Show all changes 1 commit https://github.com/simstudioai/sim/pull/6789/files
26ac161 fix(files): serve mothership chat attachments stored under a workspac… Aug 17, 2026 https://github.com/simstudioai/sim/pull/6789/commits/26ac161643323637f4cb8f6d16097a2c0afbd99f
Clear filters https://github.com/simstudioai/sim/pull/6789/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6789/files
Please reload this pagehttps://github.com/simstudioai/sim/pull/6789/files
authorization.ts https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
route.test.ts https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
route.ts https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
metadata.test.ts https://github.com/simstudioai/sim/pull/6789/files#diff-da6bdc827dda2ce0508ee14c393a97803a98123d2117513debaa31eddb50074f
metadata.ts https://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
apps/sim/app/api/files/authorization.tshttps://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
View file https://github.com/simstudioai/sim/blob/26ac161643323637f4cb8f6d16097a2c0afbd99f/apps/sim/app/api/files/authorization.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6789/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
https://github.com/simstudioai/sim/pull/6789/files#diff-1879aed9b771b6ac07ebc3daa9b658a48d2d3c1a2dda7a79df18adabc99c0a25
apps/sim/app/api/files/serve/[...path]/route.test.tshttps://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
View file https://github.com/simstudioai/sim/blob/26ac161643323637f4cb8f6d16097a2c0afbd99f/apps/sim/app/api/files/serve/%5B...path%5D/route.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6789/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
https://github.com/simstudioai/sim/pull/6789/files#diff-aaa040f5cf2c4f4a89280a9560728fcb6c688e410ee0f6945faee6a913a8634f
apps/sim/app/api/files/serve/[...path]/route.tshttps://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
View file https://github.com/simstudioai/sim/blob/26ac161643323637f4cb8f6d16097a2c0afbd99f/apps/sim/app/api/files/serve/%5B...path%5D/route.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6789/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
https://github.com/simstudioai/sim/pull/6789/files#diff-2e1bb2cb6d37718fb0edc1164a1eea09d303379d4717f3844d00ac38e92d8ae9
apps/sim/lib/uploads/server/metadata.test.tshttps://github.com/simstudioai/sim/pull/6789/files#diff-da6bdc827dda2ce0508ee14c393a97803a98123d2117513debaa31eddb50074f
View file https://github.com/simstudioai/sim/blob/26ac161643323637f4cb8f6d16097a2c0afbd99f/apps/sim/lib/uploads/server/metadata.test.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6789/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6789/files#diff-da6bdc827dda2ce0508ee14c393a97803a98123d2117513debaa31eddb50074f
https://github.com/simstudioai/sim/pull/6789/files#diff-da6bdc827dda2ce0508ee14c393a97803a98123d2117513debaa31eddb50074f
https://github.com/simstudioai/sim/pull/6789/files#diff-da6bdc827dda2ce0508ee14c393a97803a98123d2117513debaa31eddb50074f
apps/sim/lib/uploads/server/metadata.tshttps://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
View file https://github.com/simstudioai/sim/blob/26ac161643323637f4cb8f6d16097a2c0afbd99f/apps/sim/lib/uploads/server/metadata.ts
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/simstudioai/sim/pull/6789/{{ revealButtonHref }}
https://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
https://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
https://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
https://github.com/simstudioai/sim/pull/6789/files#diff-1de12a134a12569e530e519c085fb87fc17011a093468e8ae4cc6f1c1ff0f370
Please reload this pagehttps://github.com/simstudioai/sim/pull/6789/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.