mirror of
https://github.com/mssoftjp/obsidian-voice-input.git
synced 2026-07-22 06:44:48 +00:00
fix: short-circuit draft folder creation when it already exists
This commit is contained in:
parent
2f77ca92dc
commit
ab368ee387
1 changed files with 8 additions and 9 deletions
|
|
@ -30,16 +30,15 @@ export class DraftManager {
|
|||
const folderPath = this.getDraftFolderPath(app);
|
||||
const abstractFile = app.vault.getAbstractFileByPath(folderPath);
|
||||
|
||||
if (abstractFile instanceof TFolder) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (abstractFile) {
|
||||
this.logger?.warn('Draft path exists but is not a folder', { folderPath });
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
if (abstractFile instanceof TFolder) {
|
||||
return; // already exists and is a folder
|
||||
}
|
||||
if (abstractFile) {
|
||||
this.logger?.warn('Draft path exists but is not a folder', { folderPath });
|
||||
return;
|
||||
}
|
||||
|
||||
await app.vault.createFolder(folderPath);
|
||||
} catch (error) {
|
||||
const message = error instanceof Error ? error.message : String(error);
|
||||
|
|
|
|||
Loading…
Reference in a new issue