mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 13:26:01 +01:00
refactor(server/utils): simplify sanitizeFilenameForHeader
since "" is falsy, we can just use "||" here
This commit is contained in:
@@ -118,12 +118,7 @@ export async function crash() {
|
||||
}
|
||||
|
||||
export function sanitizeFilenameForHeader(filename: string) {
|
||||
let sanitizedFilename = sanitize(filename);
|
||||
|
||||
if (sanitizedFilename.trim().length === 0) {
|
||||
sanitizedFilename = "file";
|
||||
}
|
||||
|
||||
const sanitizedFilename = sanitize(filename).trim() || "file";
|
||||
return encodeURIComponent(sanitizedFilename);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user