Skip to content

Commit c366fec

Browse files
committed
docs: clarify capture target resolution
1 parent 1bd7520 commit c366fec

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/engine/CaptureChoiceEngine.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,12 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine {
283283
| { kind: "tag"; tag: string }
284284
| { kind: "folder"; folder: string }
285285
| { kind: "file"; path: string } {
286+
// Resolution order:
287+
// 1) empty => vault picker
288+
// 2) #tag => tag picker
289+
// 3) trailing "/" => folder picker (explicit)
290+
// 4) ".md" => file
291+
// 5) ambiguous => folder if it exists and no same-name file exists; else file
286292
const normalizedCaptureTo = this.stripLeadingSlash(
287293
formattedCaptureTo.trim(),
288294
);
@@ -309,10 +315,8 @@ export class CaptureChoiceEngine extends QuickAddChoiceEngine {
309315
return { kind: "file", path: normalizedCaptureTo };
310316
}
311317

312-
const fileCandidatePath = this.normalizeMarkdownFilePath(
313-
"",
314-
folderPath,
315-
);
318+
// Guard against ambiguity where a folder and file share the same name.
319+
const fileCandidatePath = this.normalizeMarkdownFilePath("", folderPath);
316320
const fileCandidate = this.app.vault.getAbstractFileByPath(
317321
fileCandidatePath,
318322
);

0 commit comments

Comments
 (0)