Skip to content

Fix folder watcher duplicate filename handling#1556

Merged
raivisdejus merged 2 commits into
chidiwilliams:mainfrom
honma89:fix-duplicate-filenames
Jul 17, 2026
Merged

Fix folder watcher duplicate filename handling#1556
raivisdejus merged 2 commits into
chidiwilliams:mainfrom
honma89:fix-duplicate-filenames

Conversation

@honma89

@honma89 honma89 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description:

Fix duplicate filename handling in the folder watcher.

Previously, the folder watcher only tracked processed files by their path. If a new file was created with the same filename as a previously processed file, it could be skipped because Buzz considered it already handled.

This change updates the tracking logic to store the file's size and modification time along with the path, so Buzz can distinguish between the same file and a new version of a file with the same name.

Changes

Prevent duplicate output filenames

Before creating the output file, the code now checks whether the target filename already exists. If it does, a numeric suffix is appended until an available filename is found.

while output_path.exists():
    output_path = output_path.with_name(
        f"{stem} ({counter}){suffix}"
    )
    counter += 1

The output path is then used instead of overwriting the existing file.

output_file = get_available_output_path(output_path)

Result

  • Existing files are no longer overwritten.
  • New files are automatically saved as:
    • audio.mp3
    • audio (1).mp3
    • audio (2).mp3
    • ...

@honma89 honma89 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello. I've addressed the duplicate filename issue by generating a unique filename whenever a conflict is detected. Appreciate it, if you could review the changes.

@raivisdejus

Copy link
Copy Markdown
Collaborator

@honma89 Thanks for the contribution

@raivisdejus
raivisdejus enabled auto-merge (squash) July 17, 2026 07:28
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.95%. Comparing base (a029f77) to head (8d9dbb3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1556      +/-   ##
==========================================
+ Coverage   82.91%   82.95%   +0.04%     
==========================================
  Files         108      108              
  Lines       11697    11697              
==========================================
+ Hits         9698     9703       +5     
+ Misses       1999     1994       -5     
Flag Coverage Δ
Linux 81.71% <100.00%> (ø)
macOS 82.46% <100.00%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@raivisdejus
raivisdejus merged commit d1b11c4 into chidiwilliams:main Jul 17, 2026
17 of 19 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.

2 participants