Overview: After opening a link to an obexftp directory on a phone in dolphin, pasting a file into that directory fails. Example url: obexftp://00-25-d0-xx-xx-xx/Speicherk./some/directory Seems to be related to a problem in trailing-slash handling in kioobexftp.cpp The problem surfaced recently while it was running ok before. I did not dig into why it was covered before (I guess something in dolphin changed). Steps to Reproduce: enter e.g. in bash: dolphin obexftp://00-25-d0-xx-xx-xx/Speicherk./some/directory paste a file already in clipboard into that directory (Ctrl+V) Actual Results: File does not appear in dolphin GUI in the directory. syslog shows: e.g. obexd[4459]: Transfer(0x563b14ca3c10) Error: Forbidden Pasted file is also not on the phone. Expected Results: File should appear in directory (in dolphin GUI and on phone). Build Date & Platform: NAME="openSUSE Tumbleweed" VERSION="20180103 " bluedevil5-5.11.5-1.1.x86_64.rpm Additional Information: Debugging result: (bluedevil-5.11.5/src/kio/obexftp/kioobexftp.cpp) The problem is caused by a failing stat() on the opened directory. This caused by having a duplicate slash in m_statMap (obexftp://00-25-d0-xx-xx-xx/Speicherk./some//directory). Short debugging run-thru: statHelper() is called for "obexftp://00-25-d0-xx-xx-xx/Speicherk./some/directory" It is not found in m_statMap so a listFolder(urlUpDir(url), &ok); is triggered to collect the missing information. urlUpDir(url) results in "obexftp://00-25-d0-xx-xx-xx/Speicherk./some/" Within listFolder() for each found directory entry L464: QUrl statUrl = url; L465: statUrl.setPath(statUrl.path() + QLatin1Char('/') + item.name()); is called. Results e.g. in "obexftp://00-25-d0-xx-xx-xx/Speicherk./some//directory". Returned to statHelper() m_statMap does still not contain a result for "obexftp://00-25-d0-xx-xx-xx/Speicherk./some//directory". So L416: qCWarning(OBEXFTP) << "statMap still does not contains the url!"; is hit. statHelper() returns its result via L419: statEntry(m_statMap.value(url.toDisplayString())); ... which is empty. Proposed fix: change L465 from statUrl.setPath(statUrl.path() + QLatin1Char('/') + item.name()); to if (statUrl.path().endsWith('/')) { statUrl.setPath(statUrl.path() + item.name()); } else { statUrl.setPath(statUrl.path() + QLatin1Char('/') + item.name()); } This is e.g. in line with addPathToUrl() in kio-5.40.0/src/core/copyjob.cpp
Typo ... Returned to statHelper() m_statMap does still not contain a result for "obexftp://00-25-d0-xx-xx-xx/Speicherk./some//directory". should read as Returned to statHelper() m_statMap does still not contain a result for "obexftp://00-25-d0-xx-xx-xx/Speicherk./some/directory".
Created attachment 109766 [details] Proposed patch
I need your full name and email to apply this patch.
Created attachment 109769 [details] Patch proposal, with sign off line
Git commit c9558516ed5ddd8ebf33767cdd22668f53b8154e by David Rosca, on behalf of Ludger Dreier. Committed on 10/01/2018 at 14:25. Pushed by drosca into branch 'master'. kio_obexftp: avoid duplicate slash when storing file stat Check if url already ends in slash ("/"). Insert slash between folder name and filename only if folder url does not end in slash. FIXED-IN: 5.12.0 M +6 -1 src/kio/obexftp/kioobexftp.cpp https://commits.kde.org/bluedevil/c9558516ed5ddd8ebf33767cdd22668f53b8154e