Skip to content

Keep the whole file name when exporting over an existing file - #11968

Merged
grliszas14 merged 3 commits into
audacity:masterfrom
jonata:fix-export-filename-truncation
Sep 18, 2026
Merged

grliszas14 merged 3 commits into
audacity:masterfrom
jonata:fix-export-filename-truncation

Conversation

@jonata

@jonata jonata commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Resolves: #11966

Picking an existing file to overwrite in the export dialog dropped everything
from the first dot onwards, so choosing

Community Roundup Spoken 9.45am 1.45pm.mp3

offered to export to Community Roundup Spoken 9.

Cause

muse::io::FileInfo::baseName() cuts at the first dot:

size_t firstDot = m_filePath.indexOf(u'.', from);

completeBaseName() cuts at the last, which is what "the name without its
extension" means here. Both places ExportPreferencesModel derives a name from
a chosen path — setFilePickerPath() and setFileDialogPath() — used the
former. They are the only two baseName() calls in src/.

It is not a length limit

The report reasonably reads this as a 26-character cap, because that is where
the truncation lands for this name. It is a coincidence: the cut is at the first
dot wherever that falls. Any name with a dot before its extension loses
everything after it, and names without one were never affected — which is why
short names looked fine.

Verification

Both functions run against muse::io::FileInfo directly. They agree on every
ordinary name and differ only where they should:

Path baseName() completeBaseName()
Community Roundup Spoken 9.45am 1.45pm.mp3 Community Roundup Spoken 9 Community Roundup Spoken 9.45am 1.45pm
song.mp3 song song
no_extension no_extension no_extension
archive.tar.gz archive archive.tar
/my.folder/track.wav track track

The last row matters: a dot in a directory name does not confuse
completeBaseName(), so paths like that are unaffected.

Because the two agree for names without an interior dot, this cannot change
behaviour for any file name that was already correct.

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

QA:

  • Testflow test cases have been run

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI (base), Organization UI (inherited)

Review profile: CHILL

Plan: Advanced

Run ID: 5498ec5a-8afd-40e9-927c-cc9a61ec8324

📥 Commits

Reviewing files that changed from the base of the PR and between a48c88f and 1a99955.

📒 Files selected for processing (2)
  • src/importexport/export/view/exportpreferencesmodel.cpp
  • src/importexport/export/view/exportpreferencesmodel.h

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

setFilePickerPath and setFileDialogPath now use FileInfo::completeBaseName(), so export filenames retain all dots before the final extension. A new exportFilePath() helper centralizes path construction. It appends the format’s first allowed extension when the current suffix is not allowed, using case-insensitive comparison. Both suggestedFilePath() and exportData() use this helper.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 1a999

The updated export-path handling preserves filenames with dots and does not introduce an identified extension-handling regression. The change is ready to merge.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the primary change: preserving the complete filename when exporting over an existing file.
Description check ✅ Passed The description includes the linked issue, problem statement, cause, verification details, and most required checklist items. The AI-assistance checklist items are omitted, but the description is othe…
Linked Issues check ✅ Passed Issue #11966 requires the Export Audio dialog to preserve the complete name of an existing file with multiple dots. The pull request changes both file-selection paths to use `FileInfo::completeBaseNam…
Out of Scope Changes check ✅ Passed The changes remain within issue #11966. The new exportFilePath() helper, extension comparison, and shared use by suggestedFilePath() and exportData() directly support correct overwrite filename …

Warning

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@teetow

teetow commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the PR! Behavior looks good to me.

@grliszas14
grliszas14 self-requested a review September 11, 2026 09:25
jonata and others added 3 commits September 18, 2026 12:56
Picking an existing file to overwrite in the export dialog dropped everything
from the first dot onwards, so choosing

    Community Roundup Spoken 9.45am 1.45pm.mp3

offered to export to "Community Roundup Spoken 9".

muse::io::FileInfo::baseName() cuts at the FIRST dot; completeBaseName() cuts
at the last, which is what "name without its extension" means here. Both places
the export dialog derives a name from a chosen path used the former.

It looks like a length limit in the report, because the truncation happens to
land 26 characters in, but the length is a coincidence - any name containing a
dot before the extension loses the rest, and names without one were never
affected.

Checked against muse's FileInfo directly, the two agree on every ordinary name
and differ only where they should:

    Community Roundup Spoken 9.45am 1.45pm.mp3  ->  ...9  |  ...9.45am 1.45pm
    song.mp3                                    ->  song  |  song
    no_extension                                ->  no_extension | no_extension
    archive.tar.gz                              ->  archive | archive.tar
@grliszas14
grliszas14 force-pushed the fix-export-filename-truncation branch from 1a99955 to 4da9d8e Compare September 18, 2026 10:56
@grliszas14
grliszas14 merged commit 1532ac3 into audacity:master Sep 18, 2026
5 of 10 checks passed
kryksyh added a commit that referenced this pull request Sep 22, 2026
Keep the whole file name when exporting over an existing file (#11968)
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.

Truncated File name when exporting audio files of a certain length

3 participants