fix(website): site links always end in a slash so images load on Filebase - #127
Merged
Merged
Conversation
…base Published sites reference their assets relatively (../<cid>). That resolves correctly only from the slashed page URL: https://ipfs.filebase.io/ipfs/<page> ../<asset> -> /<asset> 404 https://ipfs.filebase.io/ipfs/<page>/ ../<asset> -> /ipfs/<asset> 200 WebsiteGeneration.gatewayUrl -- behind every Open, Copy URL, list fallback, social caption, contact-form check and the native status card -- built the unslashed form for path-style templates. With dweb (subdomain, root already slashed) this never showed; making Filebase the default silently changed the link shape. The published fallback that should rescue an unslashed page is an inline script, and Filebase blocks inline scripts: it sends Content-Security-Policy: default-src 'self'; img-src * ...; style-src * ... with no script-src. Verified in a real browser on 2026-09-16 -- an inline script inserted into a Filebase page did not run and raised a script-src-elem violation; the reported site's image was complete with naturalWidth 0 and data-fx-try never set. So on the default gateway the slash is the only thing that makes a site's images load. Same site with the slash: image 1920px wide, served from Filebase, no script involved. The slash is applied in this getter only. publicGatewayUrlForCid also builds public FILE-share links, and asset URLs are files; both stay bare. A test pins that distinction. Subdomain templates already end in '/', so this is a no-op there. This does not reach links already copied without a slash, nor server-emitted URLs (the public directory falls back to a stored unslashed gateway_url); the server side is fixed separately. Tests: 8 new; 1089 Flutter passing; web release build; analyzer clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AwMWmCivEpYTmmzzmjSTAf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Images on generated sites don't load when opened from the app's Open / Copy URL links on Filebase.
Root cause (measured, not inferred)
WebsiteGeneration.gatewayUrlproducedhttps://ipfs.filebase.io/ipfs/<cid>— no trailing slash. From there the site's relative asset ref../<asset>resolves to/<asset>→ 404.default-src 'self', noscript-src). Browser-verified: inline script didn't run,script-src-elemviolation; reported imagenaturalWidth 0,data-fx-trynever set.Same site with the slash: image loads at 1920px from Filebase, no script needed.
Fix
The getter always returns a slashed URL. It is the single chokepoint for every page link (Open, Copy URL, websites-list fallback, social caption fallback, contact-form check, native status card).
publicGatewayUrlForCidis untouched — it also builds public file-share links, which must stay bare; a test pins that.Not covered here
Links already copied without a slash; server-emitted URLs (public directory fallback) — separate server PR.
Testing
8 new tests (both template shapes, custom template, no double slash, relative ref resolves onto the gateway, file shares stay bare) · 1089 Flutter ·
flutter build web --release✓ · analyzer clean.🤖 Generated with Claude Code
https://claude.ai/code/session_01AwMWmCivEpYTmmzzmjSTAf