Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

fix: allow .bmp uploads in filename type whitelist (#17830)

jsd82c48eaf1cb
diff --git a/api/utils/file_utils.py b/api/utils/file_utils.py
index 21b746f8f1..1381f0a563 100644
--- a/api/utils/file_utils.py
+++ b/api/utils/file_utils.py
@@ -73,7 +73,7 @@ def filename_type(filename):
return FileType.AURAL.value
if re.match(
- r".*\.(jpg|jpeg|png|tif|gif|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|avif|apng|icon|ico|mpg|mpeg|avi|rm|rmvb|mov|wmv|asf|dat|asx|wvx|mpe|mpa|mp4|avi|mkv)$", filename
+ r".*\.(jpg|jpeg|png|tif|gif|bmp|pcx|tga|exif|fpx|svg|psd|cdr|pcd|dxf|ufo|eps|ai|raw|WMF|webp|avif|apng|icon|ico|mpg|mpeg|avi|rm|rmvb|mov|wmv|asf|dat|asx|wvx|mpe|mpa|mp4|avi|mkv)$", filename
):
return FileType.VISUAL.value
diff --git a/internal/utility/file.go b/internal/utility/file.go
index d0f5e536ae..8d9910f6f4 100644
--- a/internal/utility/file.go
+++ b/internal/utility/file.go
@@ -157,7 +157,7 @@ func FilenameType(filename string) FileType {
}
visualExtensions := []string{
- "jpg", "jpeg", "png", "tif", "gif", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr",
+ "jpg", "jpeg", "png", "tif", "gif", "bmp", "pcx", "tga", "exif", "fpx", "svg", "psd", "cdr",
"pcd", "dxf", "ufo", "eps", "ai", "raw", "WMF", "webp", "avif", "apng", "icon", "ico",
"mpg", "mpeg", "avi", "rm", "rmvb", "mov", "wmv", "asf", "dat", "asx", "wvx", "mpe",
"mpa", "mp4", "mkv",
diff --git a/internal/utility/filename_type_test.go b/internal/utility/filename_type_test.go
new file mode 100644
index 0000000000..f24104801c
--- /dev/null
+++ b/internal/utility/filename_type_test.go
@@ -0,0 +1,37 @@
+//
+// Copyright 2026 The InfiniFlow Authors. All Rights Reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package utility
+
+import "testing"
+
+func TestFilenameTypeBMP(t *testing.T) {
+ cases := []struct {
+ name string
+ want FileType
+ }{
+ {"photo.bmp", FileTypeVISUAL},
+ {"PHOTO.BMP", FileTypeVISUAL},
+ {"path/to/lt50M_bmp_image_table.bmp", FileTypeVISUAL},
+ {"x.png", FileTypeVISUAL},
+ {"bad.exe", FileTypeOTHER},
+ }
+ for _, tc := range cases {
+ if got := FilenameType(tc.name); got != tc.want {
+ t.Fatalf("FilenameType(%q) = %q, want %q", tc.name, got, tc.want)
+ }
+ }
+}