TagSpaces is an offline, open source, document manager with tagging support
fixing issue with persisting metadata in web snippets
uggrockdf2fd5be31f8
diff --git a/data/chromium/popup.js b/data/chromium/popup.jsindex ee5e20e77..c0347a837 100644--- a/data/chromium/popup.js+++ b/data/chromium/popup.js@@ -204,7 +204,7 @@});// end saving all images*/- cleanedHTML = "<body data-sourceUrl='" + currentTabURL + "' data-scrapedOn='" + (new Date()) + "' >" + cleanedHTML + "</body>";+ cleanedHTML = "<body data-sourceUrl='" + currentTabURL + "' data-scrapedOn='" + (new Date()).toISOString() + "' >" + cleanedHTML + "</body>";if (htmlTemplate) {cleanedHTML = htmlTemplate.replace(/\<body[^>]*\>([^]*)\<\/body>/m, cleanedHTML); // jshint ignore:line}diff --git a/data/mozilla/capture.js b/data/mozilla/capture.jsindex 1b52f6301..abc54952e 100644--- a/data/mozilla/capture.js+++ b/data/mozilla/capture.js@@ -123,7 +123,12 @@ exports.saveURLToFile = function(name, url) {persist.ENCODE_FLAGS_ABSOLUTE_LINKS;purifyContent(window.content.document);- persist.saveDocument(window.content.document, localFile, null, null, flags, 0);++ // Set Metadata+ window.content.document.body.setAttribute('data-sourceUrl', url);+ window.content.document.body.setAttribute('data-scrapedOn',(new Date()).toISOString());++ persist.saveDocument(window.content.document, localFile, null, null, flags, 0);} else {var data = getContentFromURL(url);exports.saveContentToBinaryFile(name, data);diff --git a/data/mozilla/popup.js b/data/mozilla/popup.jsindex 0df7413aa..b4412cca8 100644--- a/data/mozilla/popup.js+++ b/data/mozilla/popup.js@@ -62,7 +62,7 @@function prepareContent(uncleanedHTML) {//console.log("uncleaned "+uncleanedHTML);var cleanedHTML = DOMPurify.sanitize(uncleanedHTML);- cleanedHTML = "<body data-sourceUrl='" + currentURL + "' data-scrapedOn='" + (new Date()) + ">" + cleanedHTML + "</body>";+ cleanedHTML = "<body data-sourceUrl='" + currentURL + "' data-scrapedOn='" + (new Date()).toISOString() + "'>" + cleanedHTML + "</body>";cleanedHTML = htmlTemplate.replace(/\<body[^>]*\>([^]*)\<\/body>/m, cleanedHTML); // jshint ignore:linereturn cleanedHTML;}