Android icon indicating copy to clipboard operation
Android copied to clipboard

Truncate export PCAP file on overwrite

Open alenz316 opened this issue 1 year ago • 1 comments

Task/Issue URL: Related to https://github.com/duckduckgo/Android/pull/4371

Description

In Android 10/11, the "w" write mode no longer truncates the file during an overwrite. More details about this workaround can be found at https://issuetracker.google.com/issues/180526528

During the fix for https://github.com/duckduckgo/Android/issues/3069 all other instances of ContentResolver.open... were reviewed to see if they also used the "w" mode. The only other one was for exporting PCAP files as it used contentResolver.openOutputStream(uri) which is a convenience function that calls contentResolver.openOutputStream(uri, "w").

Steps to test this PR

  1. Export a PCAP file and overwrite any existing file of substantial size, the exported PCAP file should now be truncated and there should no longer be trailing bytes of the overwritten file.

alenz316 avatar Mar 30 '24 19:03 alenz316

@karlenDimla can you confirm this works? Assigning it to you, feel free to close.

malmstein avatar Oct 11 '24 22:10 malmstein