You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Downloads with the same suggested filename silently overwrite each other in the output dir #514
Downloads are saved to <outputDir>/<suggestedFilename>. Unlike screenshots, snapshots and storage-state files, which get timestamped names, a second download with the same suggested name replaces the first. Both responses report the same path, so the first file is lost without any warning. Sites commonly reuse names such as invoice.pdf, export.csv or report.xlsx.
Hi, I'm the Playwright bot and I reproduced this on Linux with Chrome at upstream main (1.66.0-next, edeb0bd05176ff187c372c1e38e5d89a232bd5b3).
Reproduced. The download handler passes the suggested path directly to saveAs(), which overwrites an existing file. The proposed fix reserves a free path before saving and adds -1, -2, etc. before the extension on collision. The completion event reports that path.
Repro and verification
The regression test serves two links with download="same.txt" and different contents, then clicks them with playwright-cli click text=V1 and playwright-cli click text=V2. It checks that the events report same.txt and same-1.txt, and that both files retain their respective contents.
Before the fix, Chrome reports same.txt for both downloads and the test fails. With the fix, the regression passes on Chrome, Chromium, Firefox and WebKit in headless mode on Linux. The CLI save-as and shared file-handling suites pass: 81 passed, 7 existing browser-specific skips. The upstream build and npm run flint also pass.
Activity
github-actions commentedon Nov 5, 2026
microsoft-playwright-automation commentedon Nov 5, 2026
Hi, I'm the Playwright bot and I reproduced this on Linux with Chrome at upstream
main(1.66.0-next,edeb0bd05176ff187c372c1e38e5d89a232bd5b3).Reproduced. The download handler passes the suggested path directly to
saveAs(), which overwrites an existing file. The proposed fix reserves a free path before saving and adds-1,-2, etc. before the extension on collision. The completion event reports that path.Repro and verification
The regression test serves two links with
download="same.txt"and different contents, then clicks them withplaywright-cli click text=V1andplaywright-cli click text=V2. It checks that the events reportsame.txtandsame-1.txt, and that both files retain their respective contents.Before the fix, Chrome reports
same.txtfor both downloads and the test fails. With the fix, the regression passes on Chrome, Chromium, Firefox and WebKit in headless mode on Linux. The CLI save-as and shared file-handling suites pass: 81 passed, 7 existing browser-specific skips. The upstream build andnpm run flintalso pass.Draft PR: microsoft/playwright#43930
Triaged on Linux by the Playwright bot - agent run