Bug 470078

Summary: File sharing will fail when transferring multiple files with same name.
Product: [Applications] kdeconnect Reporter: rqirufea
Component: commonAssignee: Albert Vaca Cintora <albertvaka>
Status: RESOLVED FIXED    
Severity: normal CC: andrew.g.r.holmes
Priority: NOR    
Version First Reported In: 23.04.1   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description rqirufea 2023-05-21 07:56:09 UTC
SUMMARY
When sharing files, particularly from from the Photos app on iPhones, sometimes two files can have same file name despite being seperate files. In the iPhone's case, changing the file names in the Photos app isn't possible.


STEPS TO REPRODUCE
1. select "Send Photos and Videos" option in KDE Connect iOS app.
2. select a specific set of photos and videos.
3. tap "Add" to begin transferring.

OBSERVED RESULT
Failed transfer with a message about filenames being the same

EXPECTED RESULT
Those files with the same name being renamed like: IMG_1234.JPG, IMG_1234-1.JPG

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: EndeavourOS, Linux kernel 6.3.2
KDE Plasma Version: 5.27.5
KDE Frameworks Version: 5.106.0
Qt Version: 5.15.9
Comment 1 Bug Janitor Service 2023-05-25 00:13:58 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kdeconnect-kde/-/merge_requests/544
Comment 2 Albert Vaca Cintora 2023-05-25 22:54:39 UTC
Git commit 571575df28af878ccbe5abc91440f8d1fc36727a by Albert Vaca Cintora.
Committed on 25/05/2023 at 22:54.
Pushed by albertvaka into branch 'master'.

When receiving files, delay de-duplicating filenames

When receiving two files with the same name, the first file might not be
saved to disk already when we have to decide the name for the second if
we do it too early.

M  +13   -4    core/filetransferjob.cpp
M  +5    -0    core/filetransferjob.h
M  +1    -4    plugins/share/shareplugin.cpp

https://invent.kde.org/network/kdeconnect-kde/-/commit/571575df28af878ccbe5abc91440f8d1fc36727a