mirror of
https://github.com/onionshare/onionshare.git
synced 2025-07-21 05:52:15 -04:00
Encode the file name when adding it to the 'link' attribute of each file.
This lets the file be downloaded if it has a special character e.g #.
This commit is contained in:
parent
6e05ee4426
commit
e425c643f5
1 changed files with 3 additions and 3 deletions
|
@ -170,18 +170,18 @@ class SendBaseModeWeb:
|
||||||
if is_dir:
|
if is_dir:
|
||||||
if add_trailing_slash:
|
if add_trailing_slash:
|
||||||
dirs.append(
|
dirs.append(
|
||||||
{"link": os.path.join(f"/{path}", filename, ""), "basename": filename}
|
{"link": os.path.join(f"/{path}", quote(filename), ""), "basename": filename}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
dirs.append(
|
dirs.append(
|
||||||
{"link": os.path.join(f"/{path}", filename), "basename": filename}
|
{"link": os.path.join(f"/{path}", quote(filename)), "basename": filename}
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
size = os.path.getsize(this_filesystem_path)
|
size = os.path.getsize(this_filesystem_path)
|
||||||
size_human = self.common.human_readable_filesize(size)
|
size_human = self.common.human_readable_filesize(size)
|
||||||
files.append(
|
files.append(
|
||||||
{
|
{
|
||||||
"link": os.path.join(f"/{path}", filename),
|
"link": os.path.join(f"/{path}", quote(filename)),
|
||||||
"basename": filename,
|
"basename": filename,
|
||||||
"size_human": size_human,
|
"size_human": size_human,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue