runnerup icon indicating copy to clipboard operation
runnerup copied to clipboard

Fix some output streams writing too many bytes

Open roberi opened this issue 1 year ago • 3 comments

There is a bug in the FileUtil.copy method where the output stream writes too much data, causing the copied file not to be the same as the original file. This fix ensures that the output stream writes only the number of bytes read from the input stream.

roberi avatar Apr 02 '24 14:04 roberi

Potentially the same in Encryption encrypt (only 8 bytes, probably OK) and ManageWorkoutsActivity (saveImport not common)

Yes, definitely the same in ManageWorkoutsActivity. Should I edit this PR and make it more general to include a fix for ManageWorkoutsActivity as well, or make a new PR?

roberi avatar Apr 03 '24 12:04 roberi

Potentially the same in Encryption encrypt (only 8 bytes, probably OK) and ManageWorkoutsActivity (saveImport not common)

Yes, definitely the same in ManageWorkoutsActivity. Should I edit this PR and make it more general to include a fix for ManageWorkoutsActivity as well, or make a new PR?

You can add to this PR. Those extra occurrences are not occurring often, but it is nice to handle them at the same time. (saveImport at least) I have not checked where this PR change is actually used.

gerhardol avatar Apr 03 '24 12:04 gerhardol

You can add to this PR.

OK, will do.

I have not checked where this PR change is actually used.

FileUtil.copy is used from MainLayout.handleBundled to import workouts/schemes from the assets folder.

roberi avatar Apr 03 '24 12:04 roberi