mirror of
https://github.com/onionshare/onionshare.git
synced 2025-03-30 09:28:06 -04:00
Merge pull request #1960 from onionshare/unquote-paths-in-log-filenames
Unquote path names in --log-filenames mode
This commit is contained in:
commit
0d8623c491
@ -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 = ""
|
||||
|
||||
|
@ -29,7 +29,7 @@ from datetime import datetime, timezone
|
||||
from flask import Response, request, render_template, make_response, abort
|
||||
from unidecode import unidecode
|
||||
from werkzeug.http import parse_date, http_date
|
||||
from urllib.parse import quote
|
||||
from urllib.parse import quote, unquote
|
||||
|
||||
from .send_base_mode import SendBaseModeWeb
|
||||
|
||||
@ -347,7 +347,10 @@ class ShareModeWeb(SendBaseModeWeb):
|
||||
or self.common.platform == "BSD"
|
||||
):
|
||||
if self.web.settings.get("share", "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 = ""
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user