1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-10 20:09:57 +00:00

Adds 'created' field to attachment meta.json file (#8356)

This commit is contained in:
poc2go 2024-07-09 11:35:18 -04:00 committed by GitHub
parent f1d0e52ff7
commit 39b7a4fb71
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,6 +69,7 @@ AttachmentStore.prototype.saveAttachment = function(options) {
fs.writeFileSync(path.resolve(attachmentPath,dataFilename),options.text,contentTypeInfo.encoding);
// Save the meta.json file
fs.writeFileSync(path.resolve(attachmentPath,"meta.json"),JSON.stringify({
created: $tw.utils.stringifyDate(new Date()),
modified: $tw.utils.stringifyDate(new Date()),
contentHash: contentHash,
filename: dataFilename,
@ -94,6 +95,7 @@ AttachmentStore.prototype.adoptAttachment = function(incomingFilepath,type,hash)
fs.renameSync(incomingFilepath,dataFilepath);
// Save the meta.json file
fs.writeFileSync(path.resolve(attachmentPath,"meta.json"),JSON.stringify({
created: $tw.utils.stringifyDate(new Date()),
modified: $tw.utils.stringifyDate(new Date()),
contentHash: hash,
filename: dataFilename,
@ -137,4 +139,4 @@ AttachmentStore.prototype.getAttachmentStream = function(attachment_name) {
exports.AttachmentStore = AttachmentStore;
})();
})();