Bläddra i källkod

Fix `infer_file_type` in serving (#3877)

* Fix bug

* Fix bug

* Fix bug
Lin Manhui 7 månader sedan
förälder
incheckning
e09599dc2a
1 ändrade filer med 3 tillägg och 4 borttagningar
  1. 3 4
      paddlex/inference/serving/infra/utils.py

+ 3 - 4
paddlex/inference/serving/infra/utils.py

@@ -109,11 +109,10 @@ def infer_file_type(url: str) -> Optional[FileType]:
                 match_ = re.match(
                     r"attachment;filename=(.*)", params["responseContentDisposition"][0]
                 )
-                if not match_:
+                if match_:
                     file_type = mimetypes.guess_type(match_.group(1))[0]
-                    if file_type is None:
-                        return None
-        return None
+        if file_type is None:
+            return None
 
     if file_type.startswith("image/"):
         return "IMAGE"