refactor(sections-editor): dedupe basename/extension helpers between image and file fields#4908
Merged
pedrofrxncx merged 1 commit intoJul 21, 2026
Conversation
…image and file fields
pedrofrxncx
deleted the
refactor/sections-editor-dedupe-media-filename-w1
branch
July 21, 2026 01:14
decocms Bot
pushed a commit
that referenced
this pull request
Jul 21, 2026
PR: #4908 refactor(sections-editor): dedupe basename/extension helpers between image and file fields Bump type: patch - decocms (apps/mesh/package.json): 4.82.12 -> 4.82.13 Deploy-Scope: web
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.
Source: C1 code reduction — found while auditing
sections-editor/fieldsfor duplication.ImageFieldandFileFieldeach defined byte-identicalbasename()/extension()helpers (URL → display filename / lowercase extension, used to render the preview file name and extension badge). Collapsed both into a new local modulefields/media-filename.tsand import from there.Payoff: one copy to maintain instead of two that can silently drift; net -30/+2 across the two field files (+13-line new shared module).
Behavior: unchanged — the extracted functions are copied verbatim, only their location changed, so
ImageField/FileFieldrender identically.Reviewer check:
cd apps/mesh && bunx tsc --noEmit(green). No existing unit test covers these pure UI-formatting helpers (no trust boundary — they only affect a displayed filename), so no test was added per the coverage-gate policy.Locally verified:
bun run fmt(no changes) andbunx tsc --noEmitinapps/mesh(green). Full CI (lint, full test suite) validates the rest.Summary by cubic
Deduped filename helpers in the sections editor by extracting identical
basenameandextensionlogic fromImageFieldandFileFieldinto a shared module. No UI or behavior changes.apps/mesh/src/web/components/sections-editor/fields/media-filename.tsand updated imports inimage-field.tsxandfile-field.tsx.Written for commit 6d4f5b5. Summary will update on new commits.