Merge pull request #1312 from TriliumNext/renovate/node-22.x

chore(deps): update dependency @types/node to v22.13.8
This commit is contained in:
Elian Doran 2025-03-01 10:18:47 +02:00 committed by GitHub
commit c8a7f893e1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 8 deletions

8
package-lock.json generated
View File

@ -142,7 +142,7 @@
"@types/leaflet-gpx": "1.3.7",
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/node": "22.13.5",
"@types/node": "22.13.8",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/safe-compare": "1.1.2",
@ -4629,9 +4629,9 @@
}
},
"node_modules/@types/node": {
"version": "22.13.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.5.tgz",
"integrity": "sha512-+lTU0PxZXn0Dr1NBtC7Y8cR21AJr87dLLU953CWA6pMxxv/UDc7jYAY90upcrie1nRcD6XNG5HOYEDtgW5TxAg==",
"version": "22.13.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.13.8.tgz",
"integrity": "sha512-G3EfaZS+iOGYWLLRCEAXdWK9my08oHNZ+FHluRiggIYJPOXzhOiDgpVCUHaUvyIC5/fj7C/p637jdzC666AOKQ==",
"license": "MIT",
"dependencies": {
"undici-types": "~6.20.0"

View File

@ -193,7 +193,7 @@
"@types/leaflet-gpx": "1.3.7",
"@types/mime-types": "2.1.4",
"@types/multer": "1.4.12",
"@types/node": "22.13.5",
"@types/node": "22.13.8",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/safe-compare": "1.1.2",

View File

@ -34,7 +34,7 @@ function encrypt(key: Buffer, plainText: Buffer | string) {
throw new Error("No data key!");
}
const plainTextBuffer = Buffer.from(plainText);
const plainTextBuffer = Buffer.isBuffer(plainText) ? plainText : Buffer.from(plainText);
const iv = crypto.randomBytes(16);
const cipher = crypto.createCipheriv("aes-128-cbc", pad(key), pad(iv));
@ -88,7 +88,7 @@ function decrypt(key: Buffer, cipherText: string | Buffer): Buffer | false | nul
if (e.message?.includes("WRONG_FINAL_BLOCK_LENGTH") || e.message?.includes("wrong final block length")) {
log.info("Caught WRONG_FINAL_BLOCK_LENGTH, returning cipherText instead");
return Buffer.from(cipherText);
return (Buffer.isBuffer(cipherText) ? cipherText : Buffer.from(cipherText));
} else {
throw e;
}

View File

@ -57,7 +57,8 @@ export function hashedBlobId(content: string | Buffer) {
}
export function toBase64(plainText: string | Buffer) {
return Buffer.from(plainText).toString("base64");
const buffer = (Buffer.isBuffer(plainText) ? plainText : Buffer.from(plainText));
return buffer.toString("base64");
}
export function fromBase64(encodedText: string) {