ソースを参照

fix: remove leading dot for file extension check

Timothy Jaeryang Baek 4 ヶ月 前
コミット
1f632d3570
1 ファイル変更3 行追加0 行削除
  1. 3 0
      backend/open_webui/routers/files.py

+ 3 - 0
backend/open_webui/routers/files.py

@@ -96,6 +96,9 @@ def upload_file(
         filename = os.path.basename(unsanitized_filename)
 
         file_extension = os.path.splitext(filename)[1]
+        # Remove the leading dot from the file extension
+        file_extension = file_extension[1:] if file_extension else ""
+
         if request.app.state.config.ALLOWED_FILE_EXTENSIONS:
             request.app.state.config.ALLOWED_FILE_EXTENSIONS = [
                 ext for ext in request.app.state.config.ALLOWED_FILE_EXTENSIONS if ext