aboutsummaryrefslogtreecommitdiff
path: root/src/cachehandler.cpp
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-01-07 08:35:25 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-01-07 09:44:02 +0100
commit50729c19ebf75ab91ee285fe7af86abbdaec411c (patch)
treea45b68bc7b28e20b59f0fded5bfa89e65783ac34 /src/cachehandler.cpp
parentb7f07140cbe020a90f553cbd00fbcd9c35115579 (diff)
Fixes pages not being read from cache due to differing trailing slash
Also fixes favourites with the same problem
Diffstat (limited to 'src/cachehandler.cpp')
-rw-r--r--src/cachehandler.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/cachehandler.cpp b/src/cachehandler.cpp
index 0bd7f36..bd4c7e5 100644
--- a/src/cachehandler.cpp
+++ b/src/cachehandler.cpp
@@ -1,11 +1,13 @@
#include "cachehandler.hpp"
#include "kristall.hpp"
+#include "ioutil.hpp"
#include <QDebug>
-void CacheHandler::push(const QUrl &url, const QByteArray &body, const MimeType &mime)
+void CacheHandler::push(const QUrl &u, const QByteArray &body, const MimeType &mime)
{
- QString urlstr = url.toString(QUrl::FullyEncoded | QUrl::RemoveFragment);
+ QUrl url = IoUtil::uniformUrl(u);
+ QString urlstr = url.toString(QUrl::FullyEncoded);;
if (this->page_cache.find(urlstr) != this->page_cache.end())
{
@@ -34,7 +36,7 @@ std::shared_ptr<CachedPage> CacheHandler::find(const QString &url)
std::shared_ptr<CachedPage> CacheHandler::find(const QUrl &url)
{
- return this->find(url.toString(QUrl::FullyEncoded | QUrl::RemoveFragment));
+ return this->find(IoUtil::uniformUrlString(url));
}
bool CacheHandler::contains(const QString &url) const
@@ -44,7 +46,7 @@ bool CacheHandler::contains(const QString &url) const
bool CacheHandler::contains(const QUrl &url) const
{
- return this->contains(url.toString(QUrl::FullyEncoded | QUrl::RemoveFragment));
+ return this->contains(IoUtil::uniformUrlString(url));
}
CacheMap const& CacheHandler::getPages() const