miguelpruivo / flutter_file_picker

File picker plugin for Flutter, compatible with mobile (iOS & Android), Web, Desktop (Mac, Linux, Windows) platforms with Flutter Go support.
MIT License
1.35k stars 672 forks source link

Incorrect file extension when saving documents with the same name #1598

Closed mariagloin closed 3 weeks ago

mariagloin commented 1 month ago

Describe the bug I encountered a bug while using the saveFile() method. When attempting to save two documents with the same name (for example, "Documents.pdf"), the second file is saved as Documents.pdf (1). This results in the file extension being incorrectly appended to the file name instead of preserving it.

It appears that the code in the package does not properly handle cases where a file with the same name already exists in the directory. As a result, the Android filesystem automatically adds a number to the end of the filename to avoid conflicts, but this adjustment does not account for the file extension.

Platform

Details to reproduce the issue

  1. Save a file using the saveFile() method with the name "Documents.pdf".
  2. Attempt to save another file in the same directory with the same name.
  3. The second file is saved as Documents.pdf (1) rather than Documents (1).pdf.

Environment

Thank you in advance for looking into this issue!

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 7 days with no activity.

ChanLee90 commented 1 month ago

i have the same problem

Nimo11 commented 1 month ago

Same problem here

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 7 days with no activity.

github-actions[bot] commented 3 weeks ago

This issue was closed because it has been inactive for 14 days since being marked as stale.