Skip to content

Commit 9b57e13

Browse files
committed
cleanup
1 parent 0388622 commit 9b57e13

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const sanitizeId = (id) => {
2424
sanitized = sanitized.replace("-deleted",'');
2525
if (sanitized !== id) {
2626
return "ERR-INVALID-ID"
27-
2827
}
2928
if (sanitized.length >= maxPasteIDLength) {
3029
return "ERR-TOO-LONG-ID"
@@ -66,7 +65,9 @@ const ensureDirectoryExists = async () => {
6665
// Async helper function to write a file
6766
const saveFile = async (filePath, content) => {
6867
try {
69-
await fs.promises.writeFile(filePath, content);
68+
if(!(filePath === "ERR-INVALID-ID" || filePath === "ERR-TOO-LONG-ID")) {
69+
await fs.promises.writeFile(filePath, content);
70+
}
7071
} catch (error) {
7172
throw new Error('Failed to write file: ' + error.message);
7273
}

0 commit comments

Comments
 (0)