mirror of
https://github.com/simstudioai/sim.git
synced 2026-02-12 07:24:55 -05:00
fix(kb): handle larger files in the kb (#2324)
* fix(kb): handle larger files in the kb * fixed images on login page
This commit is contained in:
@@ -278,6 +278,7 @@ export function validateKnowledgeBaseFile(
|
||||
|
||||
/**
|
||||
* Extract storage key from a file path
|
||||
* Handles URLs like /api/files/serve/s3/key or /api/files/serve/blob/key
|
||||
*/
|
||||
export function extractStorageKey(filePath: string): string {
|
||||
let pathWithoutQuery = filePath.split('?')[0]
|
||||
@@ -292,7 +293,13 @@ export function extractStorageKey(filePath: string): string {
|
||||
}
|
||||
|
||||
if (pathWithoutQuery.startsWith('/api/files/serve/')) {
|
||||
return decodeURIComponent(pathWithoutQuery.substring('/api/files/serve/'.length))
|
||||
let key = decodeURIComponent(pathWithoutQuery.substring('/api/files/serve/'.length))
|
||||
if (key.startsWith('s3/')) {
|
||||
key = key.substring(3)
|
||||
} else if (key.startsWith('blob/')) {
|
||||
key = key.substring(5)
|
||||
}
|
||||
return key
|
||||
}
|
||||
return pathWithoutQuery
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user