Skip to content

Open source file-system and knowledge based agent template. Build AI agents that stay up to date with your knowledge base

fix(sources): correctly formats file data for blob storage

Hugo Richard6eca2aa5eeb8
diff --git a/apps/app/server/api/sources/[id]/files.put.ts b/apps/app/server/api/sources/[id]/files.put.ts
index 6c2dadc..7e7fb55 100644
--- a/apps/app/server/api/sources/[id]/files.put.ts
+++ b/apps/app/server/api/sources/[id]/files.put.ts
@@ -63,8 +63,9 @@ export default defineEventHandler(async (event) => {
const pathname = `sources/${id}/${filename}`
const contentType = field.type || 'text/plain'
+ const content = field.data.toString('utf-8')
- await blob.put(pathname, new Blob([field.data], { type: contentType }), { contentType })
+ await blob.put(pathname, content, { contentType, addRandomSuffix: false })
results.push({ filename, pathname, size: field.data.length })
}