Skip to content

7.4.6: keep admin editor uploads on the persistent volume - #12

Merged
jonradoff merged 1 commit into
mainfrom
editor-uploads-on-volume
Nov 6, 2026
Merged

jonradoff merged 1 commit into
mainfrom
editor-uploads-on-volume

Conversation

@jonradoff

Copy link
Copy Markdown
Collaborator

Problem

An image field or OG image uploaded through the admin page form was written to static/uploads inside the running image. Every deploy replaces the image, so the picture disappeared at the next deploy and the page showed a broken image. It survived only if the machine that ran ./deploy.sh happened to have a copy in its own static/uploads, which then got baked into the new image. One such file (1769086431567199000_avatar.png) has been kept alive that way since January.

Uploads through the asset library, the API and MCP already go to content/generated, on the volume, and are unaffected.

Change

  • internal/handlers/uploads.go: saveUpload writes editor uploads to UploadsDir (content/uploads, on the Fly volume at /app/content). The four editor paths (image fields and OG image, on create and on update) use it. File names and /uploads/... URLs are unchanged, and a failed save is now logged instead of ignored.
  • /uploads/ serves from handlers.UploadsDir.
  • At startup MigrateLegacyUploads copies any file the image still carries in static/uploads into content/uploads, never overwriting. So the avatar moves onto the volume on the first start of 7.4.6, and later deploys no longer depend on a local copy.
  • 7.4.6 in build.json, manifest.json and the CHANGELOG. The CHANGELOG also records Pin Docker base images by digest #11, the digest-pinned Docker images.
  • CLAUDE.md: anything written at runtime that must outlast a deploy goes under content/.

Tests

  • saveUpload, both the write path and the error when the folder can't be created.
  • MigrateLegacyUploads: it copies only missing regular files, leaves the volume's copy alone, skips dotfiles and folders, and a second run copies nothing.
  • TestCreateContent_OGImageUploadGoesToUploadsDir: a multipart create stores og_image as an /uploads/ URL whose file is under UploadsDir. It needs the test database, so it runs in CI.
  • TestMain points UploadsDir at a temp directory.
  • Locally, the full go test ./... passes with database tests skipped, along with go vet and gofmt.

After merging

Deploy with ./deploy.sh as usual. The first start logs Copied 1 legacy upload(s) into content/uploads. Then https://metavert.io/uploads/1769086431567199000_avatar.png should still return the image. Tag v7.4.6 on the merge commit.

🤖 Generated with Claude Code

Image fields and OG images uploaded through the admin page form were
written to static/uploads inside the image, which every deploy replaces,
so they vanished at the next deploy unless the deploying machine had a
copy. They are now written to content/uploads (the Fly volume) through
handlers.saveUpload, and /uploads/ serves from handlers.UploadsDir; URLs
are unchanged. At startup MigrateLegacyUploads copies files an image
still carries in static/uploads into content/uploads without overwriting.

Tests: saveUpload, MigrateLegacyUploads (copies only missing regular
files, skips dotfiles and folders), and a CreateContent multipart test
that the OG image lands under UploadsDir. TestMain points UploadsDir at
a temp directory.

Also records the pinned Docker base images (#11) in the changelog.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codecov

codecov Bot commented Nov 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@jonradoff
jonradoff merged commit 5509114 into main Nov 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant