Bug 438084 - kaccounts-providers nextcloud provider strips path from URL causing it to fail
Summary: kaccounts-providers nextcloud provider strips path from URL causing it to fail
Status: RESOLVED FIXED
Alias: None
Product: KAccounts
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Dan Leinir Turthra Jensen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-04 13:31 UTC by Thomas Greenwood
Modified: 2021-06-29 12:26 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In: 21.04.3


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Greenwood 2021-06-04 13:31:22 UTC
SUMMARY

I have my nextcloud hosted at https://www.coginternet.net/nextcloud/.
Post authentication, kaccounts-providers nextcloud provider strips "/nextcloud/" from the URL causing the account to be created incorrectly. The authentication process is able to complete and the .desktop file is created in .local/share/remoteview/ however the URL contains the stripped version and therefore does not work.

STEPS TO REPRODUCE
1. System Settings -> Online Accounts -> Add -> Nextcloud
2. Complete Authentication
3. In Dolphin, browse to Network, Nextcloud and click the added account. The account is invalid.


journalctl reveals that the URL is correct throughout the authentication process and that the authentication completes. After that, the URL is suddenly stripped and requests start to fail.

The cause might be https://invent.kde.org/network/kaccounts-providers/-/blame/master/plugins/nextcloud-ui/nextcloudcontroller.cpp#L204 where dav/host is populated using a concatenation of url.host() and "/remote.php.." which would result in this behaviour.

OBSERVED RESULT

URL is stripped of its path, from https://www.coginternet.net/nextcloud/ to https://www.coginternet.net post authentication. This invalid URL is used to create the account.

EXPECTED RESULT

URL is not stripped and the path as entered is used to create the account.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Neon 5.21 (kernel 5.8.0-55-generic)
KDE Plasma Version: 5.21.5
KDE Frameworks Version: 5.82.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
Comment 1 Thomas Greenwood 2021-06-04 13:33:28 UTC
Just noticed that the OwnCloud provider appears to have the same bit of code so could also be affected.

Also, just to confirm that editing the .desktop file to have the correct URL allows Dolphin to work however authentication is then required, I guess because the URL is not linked correctly in Wallet due to the manual change.
Comment 2 Thomas Greenwood 2021-06-28 15:02:04 UTC
Merge request raised - https://invent.kde.org/network/kaccounts-providers/-/merge_requests/27
Comment 3 Thomas Greenwood 2021-06-29 12:24:08 UTC
Git commit c0953e857c40259f839b81ced5122d26090947bb by Thomas Greenwood.
Committed on 28/06/2021 at 14:41.
Pushed by nicolasfella into branch 'master'.

Preserve Nextcloud path when returning dav data

The URL path was getting stripped post authentication. This caused all post authentication requests to fail.

M  +8    -2    plugins/nextcloud-ui/nextcloudcontroller.cpp

https://invent.kde.org/network/kaccounts-providers/commit/c0953e857c40259f839b81ced5122d26090947bb
Comment 4 Nicolas Fella 2021-06-29 12:26:20 UTC
Git commit 7a05624e4ad06c188c83d1d2590079d0a463b9b5 by Nicolas Fella, on behalf of Thomas Greenwood.
Committed on 29/06/2021 at 12:25.
Pushed by nicolasfella into branch 'release/21.04'.

Preserve Nextcloud path when returning dav data

The URL path was getting stripped post authentication. This caused all post authentication requests to fail.
(cherry picked from commit c0953e857c40259f839b81ced5122d26090947bb)

M  +8    -2    plugins/nextcloud-ui/nextcloudcontroller.cpp

https://invent.kde.org/network/kaccounts-providers/commit/7a05624e4ad06c188c83d1d2590079d0a463b9b5