Bug 462381

Summary: KIO-Extras AFC URL error
Product: [Frameworks and Libraries] kio-extras Reporter: John 'JT' Lamb <bigbearjt>
Component: AFCAssignee: Plasma Bugs List <plasma-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: ambareeshbalaji, g311571057, kde, nate, umar
Priority: NOR    
Version: 22.11.90   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 24.02
Sentry Crash Report:

Description John 'JT' Lamb 2022-11-29 04:03:29 UTC
SUMMARY
***
NOTE: If you are reporting a crash, please try to attach a backtrace with debug symbols.
See https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***


STEPS TO REPRODUCE
1. Connect iPhone with an ' in the iPhone name (e.g. JT's iPhone)
2. Dolphin will report the device UUID does not exist.

OBSERVED RESULT

kf.kio.workers.afc: Failed to normalize "JT's iPhone" into a valid URL host, this is a bug!
kf.kio.core: "The file or folder 00008101-00017d8a3cd0001e does not exist."
neon@neon:~/kio-extras-master$ 

EXPECTED RESULT
File system of iPhone should appear.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma:  KDE Neon
KDE Plasma Version: 5.26.80
KDE Frameworks Version:  5.101.0
Qt Version: 5.15.7
ADDITIONAL INFORMATION

Renaming the iPhone to "iPhone" allowed a connection to the iPhone. Upon resetting the iPhone's name to "JT's iPhone" it was uanble to connect.  Any name with a ' or " in it will cause a connection failure due to being unable to resolve the URI.

Launching dolphin from the CLI returns the following errors:

kf.kio.workers.afc: Failed to normalize "JT's iPhone" into a valid URL host, this is a bug!
kf.kio.core: "The file or folder 00008101-00017d8a3cd0001e does not exist."
org.kde.dolphin: could not find entry for charset= "Other encoding ()"
kf.kio.workers.afc: Failed to normalize "JT's iPhone" into a valid URL host, this is a bug!
kf.kio.core: "The file or folder 00008101-00017d8a3cd0001e does not exist."
Comment 1 Kai Uwe Broulik 2022-11-29 07:39:23 UTC
Will fix the friendly name resolution.

However, I'm surprised it fails to access the device nonetheless. Fallback via UDID should work and it does here. My phone does not have a dash in its UDID, however.
Comment 2 Bug Janitor Service 2022-11-29 11:25:07 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kio-extras/-/merge_requests/214
Comment 3 S. Umar 2022-12-14 15:31:06 UTC
I was having the same problem (applied all the afc patches to various components) but the changes mentioned in https://invent.kde.org/network/kio-extras/-/merge_requests/214 solved the problem.

A naive question! Is there a way to access the photos saved in the icloud? I seem to only see the photos that are on the iphone.
Comment 4 S. Umar 2023-04-25 18:24:51 UTC
This fix is not applied to 23.04.0 even though afc support is now formal. The problem still exists as explained below. Applying the below patch to kio-extras fixes the issue. This is also true on Fedora.
Comment 5 Wind He 2023-07-21 05:45:26 UTC
The above pr still doesn't be accepted
Comment 6 Chandradeep Dey 2023-10-06 12:46:47 UTC
*** Bug 472600 has been marked as a duplicate of this bug. ***
Comment 7 Bug Janitor Service 2024-02-12 11:52:25 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kio/-/merge_requests/1549
Comment 8 Kai Uwe Broulik 2024-02-20 13:56:17 UTC
Git commit 1b5301fa84403700faa359d7e41d9a4cc31bf5d0 by Kai Uwe Broulik.
Committed on 20/02/2024 at 13:36.
Pushed by broulik into branch 'master'.

KFilePlacesItem: Strip UDI prefix for player URLs

The relevant protocol handler already knows what device it's expecting.

Except for MTP, which expects mtp:udi= and its internals are more
dependent on the actual UDI.

M  +10   -1    src/filewidgets/kfileplacesitem.cpp

https://invent.kde.org/frameworks/kio/-/commit/1b5301fa84403700faa359d7e41d9a4cc31bf5d0
Comment 9 Bug Janitor Service 2024-02-20 14:24:59 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/kio-extras/-/merge_requests/332
Comment 10 Kai Uwe Broulik 2024-02-20 19:48:42 UTC
Git commit 6ea74a117a85235238567d758ab0d0da60829d55 by Kai Uwe Broulik.
Committed on 20/02/2024 at 14:20.
Pushed by broulik into branch 'master'.

afc: Drop pretty name handling

Instead, set UDI as host and rely on KFilePlaces to
match up the names.

M  +13   -6    afc/afcurl.cpp
M  +2    -0    afc/afcurl.h
M  +14   -108  afc/kio_afc.cpp
M  +1    -5    afc/kio_afc.h

https://invent.kde.org/network/kio-extras/-/commit/6ea74a117a85235238567d758ab0d0da60829d55
Comment 11 Kai Uwe Broulik 2024-02-20 20:23:08 UTC
Git commit 85e831b581466f737b2111b0cff034f3756bc209 by Kai Uwe Broulik.
Committed on 20/02/2024 at 19:49.
Pushed by broulik into branch 'release/24.02'.

afc: Drop pretty name handling

Instead, set UDI as host and rely on KFilePlaces to
match up the names.


(cherry picked from commit 6ea74a117a85235238567d758ab0d0da60829d55)

M  +13   -6    afc/afcurl.cpp
M  +2    -0    afc/afcurl.h
M  +14   -108  afc/kio_afc.cpp
M  +1    -5    afc/kio_afc.h

https://invent.kde.org/network/kio-extras/-/commit/85e831b581466f737b2111b0cff034f3756bc209