Merge pull request #1960 from onionshare/unquote-paths-in-log-filenames

Unquote path names in --log-filenames mode
This commit is contained in:
Saptak Sengupta 2025-02-10 12:55:46 +05:30 committed by GitHub
commit 0d8623c491
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 4 deletions

View file

@ -25,7 +25,7 @@ import mimetypes
import gzip
from flask import Response, request
from unidecode import unidecode
from urllib.parse import quote
from urllib.parse import quote, unquote
class SendBaseModeWeb:
@ -246,7 +246,10 @@ class SendBaseModeWeb:
or self.common.platform == "BSD"
):
if self.web.settings.get(self.web.mode, "log_filenames"):
filename_str = f"{path} - "
# Decode and sanitize the path to remove newlines
decoded_path = unquote(path)
decoded_path = decoded_path.replace("\r", "").replace("\n", "")
filename_str = f"{decoded_path} - "
else:
filename_str = ""