mirror of
https://github.com/zadam/trilium.git
synced 2026-05-07 14:07:10 +02:00
chore(client-standalone): address requested changes
This commit is contained in:
@@ -343,7 +343,9 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
|
||||
|
||||
content = prepareContent(noteMeta.title, content, noteMeta, undefined);
|
||||
|
||||
archive.append(content as Buffer, { name: filePathPrefix + noteMeta.dataFileName });
|
||||
archive.append(typeof content === "string" ? content : Buffer.from(content), {
|
||||
name: filePathPrefix + noteMeta.dataFileName
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -375,7 +377,7 @@ async function exportToZip(taskContext: TaskContext<"export">, branch: BBranch,
|
||||
const attachment = note.getAttachmentById(attachmentMeta.attachmentId);
|
||||
const content = attachment.getContent();
|
||||
|
||||
archive.append(content as Buffer, {
|
||||
archive.append(typeof content === "string" ? content : Buffer.from(content), {
|
||||
name: filePathPrefix + attachmentMeta.dataFileName,
|
||||
date: dateUtils.parseDateTime(note.utcDateModified)
|
||||
});
|
||||
|
||||
@@ -149,8 +149,8 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
||||
}
|
||||
|
||||
const note = this.branch.getNote();
|
||||
const fullHtml = this.prepareContent(rootMeta.title ?? "", note.getContent(), rootMeta, note, this.branch);
|
||||
this.archive.append(fullHtml as Buffer, { name: this.indexMeta.dataFileName });
|
||||
const content = this.prepareContent(rootMeta.title ?? "", note.getContent(), rootMeta, note, this.branch);
|
||||
this.archive.append(typeof content === "string" ? content : Buffer.from(content), { name: this.indexMeta.dataFileName });
|
||||
}
|
||||
|
||||
#saveAssets(rootMeta: NoteMeta, assetsMeta: NoteMeta[]) {
|
||||
@@ -178,7 +178,9 @@ export default class ShareThemeExportProvider extends ZipExportProvider {
|
||||
continue;
|
||||
};
|
||||
const fontFileName = `assets/icon-pack-${iconPack.prefix.toLowerCase()}.${extension}`;
|
||||
this.archive.append(fontData as Buffer, { name: fontFileName });
|
||||
this.archive.append(typeof fontData === "string" ? fontData : Buffer.from(fontData), {
|
||||
name: fontFileName
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ function processContent(content: Uint8Array | string | null, isProtected: boolea
|
||||
|
||||
if (isStringContent) {
|
||||
if (content === null) return "";
|
||||
if (typeof content === "string") return content;
|
||||
return decodeUtf8(content as Uint8Array);
|
||||
return decodeUtf8(content);
|
||||
}
|
||||
// see https://github.com/zadam/trilium/issues/3523
|
||||
// IIRC a zero-sized buffer can be returned as null from the database
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import log, { getLog } from "./log.js";
|
||||
import { getLog } from "./log.js";
|
||||
|
||||
const NOTE_TITLE_CHANGED = "NOTE_TITLE_CHANGED";
|
||||
const ENTER_PROTECTED_SESSION = "ENTER_PROTECTED_SESSION";
|
||||
|
||||
Reference in New Issue
Block a user