We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0388622 commit 9b57e13Copy full SHA for 9b57e13
1 file changed
index.js
@@ -24,7 +24,6 @@ const sanitizeId = (id) => {
24
sanitized = sanitized.replace("-deleted",'');
25
if (sanitized !== id) {
26
return "ERR-INVALID-ID"
27
-
28
}
29
if (sanitized.length >= maxPasteIDLength) {
30
return "ERR-TOO-LONG-ID"
@@ -66,7 +65,9 @@ const ensureDirectoryExists = async () => {
66
65
// Async helper function to write a file
67
const saveFile = async (filePath, content) => {
68
try {
69
- await fs.promises.writeFile(filePath, content);
+ if(!(filePath === "ERR-INVALID-ID" || filePath === "ERR-TOO-LONG-ID")) {
+ await fs.promises.writeFile(filePath, content);
70
+ }
71
} catch (error) {
72
throw new Error('Failed to write file: ' + error.message);
73
0 commit comments