diff --git a/server/src/cache.js b/server/src/cache.js index 1704f8e4..fe0b9f0a 100644 --- a/server/src/cache.js +++ b/server/src/cache.js @@ -154,6 +154,8 @@ function getAutoFilename(attachment) { async function removeAttachmentTimestamps(data) { if (!data?.__tableName) return data; + data = JSON.parse(JSON.stringify(data)); + let tableData = slmnggAttachments[data.__tableName]; if (tableData) { tableData.forEach(key => { @@ -162,7 +164,8 @@ async function removeAttachmentTimestamps(data) { let { ending, filename } = getAutoFilename(attachment); attachment._autoFilename = filename; attachment.fileExtension = ending; - attachments.set(attachment.id, {...attachment}); + attachments.set(attachment.id, JSON.parse(JSON.stringify(attachment))); + // console.log("att set", attachment, attachments.get(attachment.id)); // we don't want the URLs to appear in requests anymore // the data server just uses the attachment IDs @@ -173,6 +176,7 @@ async function removeAttachmentTimestamps(data) { size = attachment.thumbnails[size]; size.url = null; // generateAttachmentURL(size.url, attachment); } + }); } }); diff --git a/server/src/images.js b/server/src/images.js index 86fd6120..7b6d1338 100644 --- a/server/src/images.js +++ b/server/src/images.js @@ -213,6 +213,8 @@ module.exports = ({ app, cors, Cache, corsHandle }) => { // not already cached console.log("[image]", `no file for ${filename} (${att.filename}) @ ${size}`); + if (!airtableURL) return res.status(404).send("No URL available for this image"); + // first download or retrieve to orig/ let orig = await getOrWaitForDownload(airtableURL, filename, "orig");