]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Replace commas with underscores to handle Chrome issues with commas
authorTrenton Holmes <797416+stumpylog@users.noreply.github.com>
Wed, 15 Mar 2023 02:08:10 +0000 (19:08 -0700)
committerTrenton H <797416+stumpylog@users.noreply.github.com>
Wed, 15 Mar 2023 17:29:04 +0000 (10:29 -0700)
src/documents/views.py

index ca162e06d0fbcb84e585ef2336ba3fa33a9eb2ce..e7b0fdaa5c1ab4c45b950cceecb9d6f8a3701a11 100644 (file)
@@ -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}; "