From 5ff2460d239436cae71671539d30eab4c95cfe33 Mon Sep 17 00:00:00 2001 From: Raven Scott Date: Sun, 9 Jun 2024 06:44:26 -0400 Subject: [PATCH] add debug, last try for now --- app.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 9cded40..9db7de8 100644 --- a/app.js +++ b/app.js @@ -121,10 +121,14 @@ async function initialize() { await drive.put(`/icons/${username}.png`, avatarBuffer); updateIcon(username, avatarBuffer); } else if (messageObj.type === 'file') { - const fileBuffer = Buffer.from(messageObj.fileData, 'base64'); - await drive.put(messageObj.filePath, fileBuffer); - const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`; - addFileMessage(messageObj.name, messageObj.fileName, fileUrl, messageObj.fileType, messageObj.avatar); + try { + const fileBuffer = Buffer.from(messageObj.fileData, 'base64'); + await drive.put(messageObj.filePath, fileBuffer); + const fileUrl = `http://localhost:${servePort}${messageObj.filePath}`; + addFileMessage(messageObj.name, messageObj.fileName, fileUrl, messageObj.fileType, messageObj.avatar); + } catch (error) { + console.error('Error putting file:', error); + } } else { onMessageAdded(messageObj.name, messageObj.message, messageObj.avatar); }