fix(share): preserve Android attachments with duplicate filenames - #57
Conversation
|
Reopening this for your consideration after checking the upstream implementation. The filename collision is inherited from the The change here gives each attachment its own cache subdirectory, preventing that overwrite while preserving the original filenames. Would you be open to merging this fix here? If you'd prefer to keep parity with |
|
Hello! Thank you for filing this and for the precise information. We’ll take a look soon. |
|
Thanks for the fix and the clear test cases! We reproduced the overwrite on Android and confirmed your change resolves it. Merging this, and we'll apply it to the published dartnative_share plugin too, so it ships in its next release. |
Sharing
/a/report.pdfand/b/report.pdfon Android copies both files todn_share/report.pdf. The second copy overwrites the first, so both attachment URIs deliver the second report's contents.Give each attachment an indexed cache subdirectory while preserving its original filename. Clear those subdirectories recursively on the next share.
Validation on an Android 16 / API 36 emulator, using the patched Kotlin bridge, real
FileProviderand system chooser, and a separate receiving app:report.pdffiles produced the same URI and the second report twice. After: distinct URIs deliver both original contents and retain both filenames.git diff --checkpassed.Validation used an isolated native Android harness; a full
dnSDK build was not run.