kdirshare: do not percentage-encode the file links

if only there was a way to tell browsers:
Hey, browser! Don't decode the URL - you don't know where it points to!

for reference:
https://ibb.co/cyhwppK

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-01 19:07:10 +03:00
parent 114265bd60
commit 1b116dbc2e

View file

@ -170,7 +170,9 @@ static QByteArray contentForFile(const QString &basedir, const QFileInfo &filein
}
data.append(" <td><a href=\"");
data.append(QUrl::toPercentEncoding(cleanpath));
// NOTE: browsers produce bogus URLs for mixed (non-percentage and percentage-encoded) paths,
// also browsers decode percentage URLs and pass it back which for local files may be invalid
data.append(cleanpath.toUtf8());
data.append("\">");
data.append(fileinfo.fileName().toUtf8());
data.append("</a></td>\n");