Commit 3a019a96 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Notifications: Don't use place for paths under root

This avoids showing paths like /tmp/somefile as "500 GiB Internal
Hard Drive/tmp/somefile", or "Root/tmp/somefile".
It's more sensible to show the actual path in this case.
parent c18d69c2
Pipeline #222683 passed with stage
in 17 minutes and 48 seconds
......@@ -114,12 +114,18 @@ QString JobPrivate::prettyUrl(const QUrl &_url) const
QString pathInsidePlace = url.path().mid(placeUrl.path().length());
if (!pathInsidePlace.isEmpty() && !pathInsidePlace.startsWith(QLatin1Char('/'))) {
if (!pathInsidePlace.startsWith(QLatin1Char('/'))) {
pathInsidePlace.prepend(QLatin1Char('/'));
}
if (pathInsidePlace != QLatin1Char('/')) {
text.append(pathInsidePlace);
// Avoid "500 GiB Internal Hard Drive/foo/bar" when path originates directly from root.
const bool isRoot = placeUrl.isLocalFile() && placeUrl.path() == QLatin1Char('/');
if (isRoot) {
text = pathInsidePlace;
} else {
text.append(pathInsidePlace);
}
}
return text;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment