diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-01-07 08:35:25 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-01-07 09:44:02 +0100 |
| commit | 50729c19ebf75ab91ee285fe7af86abbdaec411c (patch) | |
| tree | a45b68bc7b28e20b59f0fded5bfa89e65783ac34 /src/ioutil.cpp | |
| parent | b7f07140cbe020a90f553cbd00fbcd9c35115579 (diff) | |
Fixes pages not being read from cache due to differing trailing slash
Also fixes favourites with the same problem
Diffstat (limited to 'src/ioutil.cpp')
| -rw-r--r-- | src/ioutil.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/ioutil.cpp b/src/ioutil.cpp index 00caba6..6257877 100644 --- a/src/ioutil.cpp +++ b/src/ioutil.cpp @@ -34,3 +34,18 @@ QString IoUtil::size_human(qint64 size) } return QString().setNum(num,'f',2)+" "+unit; } + +QUrl IoUtil::uniformUrl(QUrl url) +{ + // We have to manually strip the root path slash + // since StripTrailingSlash doesn't strip it for some reason. + if (url.path() == "/") url.setPath(QString { }); + + // This will strip slashes from non-root paths + return url.adjusted(QUrl::RemoveFragment | QUrl::StripTrailingSlash); +} + +QString IoUtil::uniformUrlString(QUrl url) +{ + return IoUtil::uniformUrl(url).toString(QUrl::FullyEncoded); +} |
