fix(app): Added proper encoding to avoid app crashes while downloading files. Fixes: RCCE-37

This commit is contained in:
Serhii Ilin 2024-01-26 16:45:54 +02:00
parent 6192f14c32
commit e146c08808

View file

@ -808,9 +808,11 @@ class RepoFilesView(RepoAppView):
safe_path = f_name.replace('"', '\\"')
encoded_path = urllib.parse.quote(f_name)
return "attachment; " \
"filename=\"{}\"; " \
"filename*=UTF-8\'\'{}".format(safe_path, encoded_path)
headers = "attachment; " \
"filename=\"{}\"; " \
"filename*=UTF-8\'\'{}".format(safe_path, encoded_path)
return headers.encode().decode('iso-8859-1', errors='replace')
@LoginRequired()
@HasRepoPermissionAnyDecorator(