Skip to content
Commit 38998e06 authored by Ahmad Samir's avatar Ahmad Samir
Browse files

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

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.
parent 1cca05e9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment