Skip to content

Commit 4169a25

Browse files
committed
address bugbot comment
1 parent 0aeaf6f commit 4169a25

File tree

1 file changed

+3
-9
lines changed
  • apps/sim/app/api/tools/mistral/parse

1 file changed

+3
-9
lines changed

apps/sim/app/api/tools/mistral/parse/route.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,9 @@ export async function POST(request: NextRequest) {
156156
}
157157
}
158158

159-
// Detect image URLs by extension for proper Mistral API type
160-
const lowerUrl = fileUrl.toLowerCase()
161-
const isImageUrl =
162-
lowerUrl.endsWith('.png') ||
163-
lowerUrl.endsWith('.jpg') ||
164-
lowerUrl.endsWith('.jpeg') ||
165-
lowerUrl.endsWith('.gif') ||
166-
lowerUrl.endsWith('.webp') ||
167-
lowerUrl.endsWith('.avif')
159+
const imageExtensions = ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.avif']
160+
const pathname = new URL(fileUrl).pathname.toLowerCase()
161+
const isImageUrl = imageExtensions.some((ext) => pathname.endsWith(ext))
168162

169163
if (isImageUrl) {
170164
mistralBody.document = {

0 commit comments

Comments
 (0)