From e0dd95c976b34c7da04dfd266b09c32875c57f46 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Thu, 5 May 2022 14:16:42 +0300 Subject: [PATCH] khttpd: handle percent-encoded path requests Signed-off-by: Ivailo Monev --- khttpd/khttpd.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/khttpd/khttpd.cpp b/khttpd/khttpd.cpp index aa0bb0c3..bdd4353b 100644 --- a/khttpd/khttpd.cpp +++ b/khttpd/khttpd.cpp @@ -198,7 +198,8 @@ void KHTTPD::handleRequest() HttpHeaderParser headerparser; headerparser.parseHeader(request); - QFileInfo pathinfo(m_directory + QLatin1Char('/') + headerparser.path()); + const QString normalizedpath = QUrl::fromPercentEncoding(headerparser.path().toAscii()); + QFileInfo pathinfo(m_directory + QLatin1Char('/') + normalizedpath); // qDebug() << Q_FUNC_INFO << headerparser.path() << pathinfo.filePath(); const bool isdirectory = pathinfo.isDir(); const bool isfile = pathinfo.isFile();