fix(profile): stop deleting the shared default banner on upload - #220
Merged
Conversation
The banner guard compared the stored path against "banners/default_banner.jpeg", but the Prisma schema default is "banners/default_banner.jpe". The check never matched, so the first banner upload by any user still holding the default deleted the shared default object from R2. Replace the per-use-case constants with a shared isDefaultMediaKey() that matches on the file name stem, so a full CDN URL, a cache-busting query string or a different extension all still count as a default asset. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PwzkQ5YGFXSB9jWCZKzX4H
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 26, 2026
## [1.7.4](v1.7.3...v1.7.4) (2026-08-26) ### Bug Fixes * **profile:** stop deleting the shared default banner on upload ([#220](#220)) ([e41f272](e41f272))
|
🎉 This PR is included in version 1.7.4 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Problem
https://cdn.developernetwork.net/banners/default_banner.jpereturned 404 — the shared default banner had been deleted from R2.UpdateBannerUseCaseguarded the cleanup of the old banner witholdBannerUrl.includes("banners/default_banner.jpeg"), but the Prisma schema default isbanners/default_banner.jpe(note the extension, both inprisma/models/profile.prismaand in0_init). The guard never matched, so the first banner upload by any user still holding the default calledstorageService.delete("banners/default_banner.jpe")and removed the shared object for everyone.UpdateAvatarUseCasehad the same shape but its constant happened to match the schema, so avatars were unaffected.Fix
src/core/domain/constants/default-media.constants.tsexportingDEFAULT_AVATAR_KEY,DEFAULT_BANNER_KEY(both mirroring the schema defaults) andisDefaultMediaKey().isDefaultMediaKey()matches on the file name stem (default_profile/default_banner), so a bare key, a full CDN URL, a cache-busting?v=1query string or a different extension all still count as a default asset.?v=1.Verification
pnpm vitest run --config vitest.unit.config.ts tests/unit/core/use-cases/profile/— 55 passedtsc -p tsconfig.build.json --noEmit,pnpm lint, prettier — cleanOps
The deleted object has already been re-uploaded to R2 at
banners/default_banner.jpe. If the 404 was cached at the edge, purge that URL in Cloudflare.🤖 Generated with Claude Code
https://claude.ai/code/session_01PwzkQ5YGFXSB9jWCZKzX4H