Open-source and local-first Slack and Notion alternative that puts you in control of your data
TypeScript chatchat-applicationcrdteditorelectronknowledge-baselocal-firstnotionnotion-alternativerealtime-collaborationself-hostedslacksqliteteam-collaborationwikiyjs
Fix for file upload
Hakan Shehu05b62cebcc75
diff --git a/desktop/src/main/file-manager.ts b/desktop/src/main/file-manager.tsindex 54cfd9e8..abf52bd1 100644--- a/desktop/src/main/file-manager.ts+++ b/desktop/src/main/file-manager.ts@@ -116,11 +116,12 @@ class FileManager {const presignedUrl = data.url;const fileStream = fs.createReadStream(filePath);-- const formData = new FormData();- formData.append('file', fileStream);-- await axios.put(presignedUrl, formData);+ await axios.put(presignedUrl, fileStream, {+ headers: {+ 'Content-Type': attributes.mimeType,+ 'Content-Length': attributes.size,+ },+ });await workspaceDatabase.deleteFrom('uploads')diff --git a/desktop/src/main/synchronizer.ts b/desktop/src/main/synchronizer.tsindex b79dca26..54bd79a2 100644--- a/desktop/src/main/synchronizer.ts+++ b/desktop/src/main/synchronizer.ts@@ -68,7 +68,7 @@ class Synchronizer {.where('id', '=', account.id).execute();} catch (error) {- console.log('error', error);+ // console.log('error', error);}}}@@ -100,9 +100,9 @@ class Synchronizer {try {await this.checkForChanges(credentials);- // await fileManager.checkForUploads(credentials);+ await fileManager.checkForUploads(credentials);} catch (error) {- console.log('error', error);+ // console.log('error', error);}}}diff --git a/server/src/routes/files.ts b/server/src/routes/files.tsindex 2efa28a3..72300456 100644--- a/server/src/routes/files.ts+++ b/server/src/routes/files.ts@@ -148,6 +148,8 @@ filesRouter.post(const command = new PutObjectCommand({Bucket: BUCKET_NAMES.FILES,Key: `files/${fileId}${node.attributes.extension}`,+ ContentLength: node.attributes.size,+ ContentType: node.attributes.mimeType,});const presignedUrl = await getSignedUrl(filesStorage, command, {