Bug 453450 - Empty file being created even when receive operation fails
Summary: Empty file being created even when receive operation fails
Status: REPORTED
Alias: None
Product: kdeconnect
Classification: Applications
Component: android-application (show other bugs)
Version: unspecified
Platform: Android Android 11.x
: NOR normal
Target Milestone: ---
Assignee: Albert Vaca Cintora
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-06 04:05 UTC by jejoxe6725
Modified: 2022-05-06 23:51 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jejoxe6725 2022-05-06 04:05:17 UTC
SUMMARY
If receive operation fails from the senders side even before any file data is sent, then the receiver will create an empty file.

STEPS TO REPRODUCE
1. Grant all storage permission required to receive a file.
2. Send a file such that the receive operation fails due to some reason even before any bytes are received at the receiver end.
3. Check the folder where the file would have been saved had it been received correctly

OBSERVED RESULT
File of size 0 bytes is created.

EXPECTED RESULT
No file should be created.
Possible fix is to not call `openFile(...)` inside `if (numFiles == 1 && currentNetworkPacket.getBoolean("open", false))` at https://invent.kde.org/network/kdeconnect-android/-/blob/master/src/org/kde/kdeconnect/Plugins/SharePlugin/CompositeReceiveFileJob.java#L218
Comment 2 Patrick Silva 2022-05-06 13:48:50 UTC
Similar issue reported as bug 445703
Comment 3 jejoxe6725 2022-05-06 23:51:55 UTC
Right. But, the fix to both of them seem to be in different components.
- The fix to bug 445703 is probably in Dolphin or the component Dolphin internally uses.
- The fix to this bug is in kdeconnect-android (https://invent.kde.org/network/kdeconnect-android/-/blob/master/src/org/kde/kdeconnect/Plugins/SharePlugin/CompositeReceiveFileJob.java)