Browse Source

Fix for url-schemes with quotes

Last quote would not be matched due to the optional last quote in the regex, resulting in an `.stl"` extension

CURA-12282
c.lamboo 3 months ago
parent
commit
7507ebad6a
1 changed files with 2 additions and 2 deletions
  1. 2 2
      cura/CuraApplication.py

+ 2 - 2
cura/CuraApplication.py

@@ -1905,10 +1905,10 @@ class CuraApplication(QtApplication):
                         # Use a regex to extract the filename
                         content_disposition = str(response.rawHeader(content_disposition_header_key).data(),
                                                   encoding='utf-8')
-                        content_disposition_match = re.match(r'attachment; filename="?(?P<filename>.*)"?',
+                        content_disposition_match = re.match(r'attachment; filename=(?P<filename>.*)',
                                                              content_disposition)
                         if content_disposition_match is not None:
-                            filename = content_disposition_match.group("filename")
+                            filename = content_disposition_match.group("filename").strip("\"")
 
                     tmp = tempfile.NamedTemporaryFile(suffix=filename, delete=False)
                     with open(tmp.name, "wb") as f: