Skip to content

Commit

Permalink
fix: folder containing 'notes' breaks file tree
Browse files Browse the repository at this point in the history
  • Loading branch information
shatQ committed Dec 3, 2024
1 parent c84e01f commit 5b05956
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/helpers/filetreeUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ function getPermalinkMeta(note, key) {
if (note.data["dg-path"]) {
folders = note.data["dg-path"].split("/");
} else {
folders = note.filePathStem
.split("notes/")[1]
.split("/");
}
// Ensure we extract everything after the LAST "notes/" occurrence
const parts = note.filePathStem.split("/notes/");
if (parts.length > 1) {
folders = parts.slice(-1)[0].split("/"); // Take the last part after "notes/"
} else {
folders = []; // Handle unexpected cases gracefully
}
}
folders[folders.length - 1]+= ".md";
} catch {
//ignore
Expand Down

0 comments on commit 5b05956

Please sign in to comment.