Skip to content

Commit

Permalink
fix: file already exists error caused by having duplicate article titles
Browse files Browse the repository at this point in the history
  • Loading branch information
sywhb committed Sep 27, 2023
1 parent c9f4a72 commit 8dec30f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,17 @@ export default class OmnivorePlugin extends Plugin {
continue;
}
// file doesn't exist, so we need to create it
await this.app.vault.create(normalizedPath, content);
try {
await this.app.vault.create(normalizedPath, content);
} catch (error) {
if (error.toString().includes("File already exists")) {
new Notice(
`Skipping file creation: ${normalizedPath}. Please check if you have duplicated article titles and delete the file if needed.`
);
} else {
throw error;
}
}
}
}

Expand Down

0 comments on commit 8dec30f

Please sign in to comment.