Skip to content

Commit f62fe99

Browse files
authored
Allow overwrite of an empty location property (#266)
* Allow overwrite of an empty location property The "Add geolocation (front matter) to current note" action correctly avoids overwriting an existing location property. But I'm fussy about the order of properties in my location notes, so I prefer to apply a template with an empty location property in the right place. This change allows the action to overwrite an existing entry if it is null. * Reformat README.md to satisfy stylecheck
1 parent bddd148 commit f62fe99

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ export async function verifyOrAddFrontMatter(
175175
): Promise<boolean> {
176176
let locationAdded = false;
177177
await app.fileManager.processFrontMatter(file, (frontmatter: any) => {
178-
if (fieldName in frontmatter && skipIfExists) {
178+
if (
179+
fieldName in frontmatter &&
180+
frontmatter[fieldName] !== null &&
181+
skipIfExists
182+
) {
179183
locationAdded = false;
180184
return;
181185
}

0 commit comments

Comments
 (0)