Skip to content

[StatJob] Make mostLocalUrl ignore remote (ftp, http...etc) URLs

Ahmad Samir requested to merge work/most-local-url into master

Summary: Previously mostLocalUrl would check that !url.isLocalFile(), that meant a statjob would be fired for remote urls (ftp, http... etc), such urls will never have a mostLocalUrl. Instead check for protocols with Class=:local.

Also if the statjob is created via KIO::mostLocalUrl, the job was, correctly, cancelled if the url isLocalFile(), extend it to also cancel the job if the protocol Class isn't ":local".

For a list of such protocols: grep :local /usr/share/kservices5/*.protocol

Thanks to sitter for figuring it out in the bug report.

BUG: 420985

FIXED-IN: 5.71

Test Plan:

  • The jobtest unit test still passes, and a new unit test that tests that mostLocalUrl for a local file was added
  • The testtrash unit test was extended to test mostLocalUrl (returns url as-is as the Trash protocol doesn't set UDS_LOCAL_PATH)

Reviewers: #frameworks, dfaure, sitter

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29782

Construct QUrl correctly with trash:/ protocol

Don't check the protocol class, checking if UDS_LOCAL_PATH is set is enough.

Edited by David Faure

Merge request reports