From bfaede26c4f5d955f8bd4e01aca855b170fe0f24 Mon Sep 17 00:00:00 2001 From: Trenton Holmes <797416+stumpylog@users.noreply.github.com> Date: Tue, 14 Mar 2023 19:08:10 -0700 Subject: [PATCH] Replace commas with underscores to handle Chrome issues with commas --- src/documents/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/documents/views.py b/src/documents/views.py index ca162e06d..e7b0fdaa5 100644 --- a/src/documents/views.py +++ b/src/documents/views.py @@ -311,7 +311,11 @@ class DocumentViewSet( # Firefox is not able to handle unicode characters in filename field # RFC 5987 addresses this issue # see https://datatracker.ietf.org/doc/html/rfc5987#section-4.2 - filename_normalized = normalize("NFKD", filename).encode("ascii", "ignore") + # Chromium cannot handle commas in the filename + filename_normalized = normalize("NFKD", filename.replace(",", "_")).encode( + "ascii", + "ignore", + ) filename_encoded = quote(filename) content_disposition = ( f"{disposition}; "