mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
web: sanitize filename for single note export
This commit is contained in:
committed by
Abdullah Atta
parent
35210ad02b
commit
7e4ab8e14b
@@ -22,6 +22,7 @@ import { TaskManager } from "./task-manager";
|
|||||||
import { zip } from "../utils/zip";
|
import { zip } from "../utils/zip";
|
||||||
import { saveAs } from "file-saver";
|
import { saveAs } from "file-saver";
|
||||||
import { showToast } from "../utils/toast";
|
import { showToast } from "../utils/toast";
|
||||||
|
import { sanitizeFilename } from "../utils/filename";
|
||||||
|
|
||||||
export async function exportToPDF(
|
export async function exportToPDF(
|
||||||
title: string,
|
title: string,
|
||||||
@@ -83,7 +84,7 @@ export async function exportNotes(
|
|||||||
if (files.length === 1) {
|
if (files.length === 1) {
|
||||||
saveAs(
|
saveAs(
|
||||||
new Blob([Buffer.from(files[0].content, "utf-8")]),
|
new Blob([Buffer.from(files[0].content, "utf-8")]),
|
||||||
`${files[0].filename}.${format}`
|
`${sanitizeFilename(files[0].filename)}.${format}`
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const zipped = await zip(files, format);
|
const zipped = await zip(files, format);
|
||||||
|
|||||||
Reference in New Issue
Block a user