Skip to content

Commit ffcf2d5

Browse files
committed
nits
1 parent 9d33307 commit ffcf2d5

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

apps/obsidian/src/utils/publishNode.ts

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ export const publishNode = async ({
3939
}
4040
const contentId = idResponse.data.id;
4141
const lastModifiedDb = new Date(idResponse.data.last_modified + "Z");
42-
console.log(
43-
idResponse.data.last_modified,
44-
lastModifiedDb.getTime(),
45-
file.stat.mtime,
46-
);
4742
if (
4843
existingPublish.includes(myGroup) &&
4944
file.stat.mtime <= lastModifiedDb.getTime()
@@ -124,10 +119,11 @@ export const publishNode = async ({
124119
// do not fail on cleanup
125120
if (cleanupResult.error) console.error(cleanupResult.error);
126121

127-
await plugin.app.fileManager.processFrontMatter(
128-
file,
129-
(fm: Record<string, unknown>) => {
130-
fm.publishedToGroups = [...existingPublish, myGroup];
131-
},
132-
);
122+
if (!existingPublish.includes(myGroup))
123+
await plugin.app.fileManager.processFrontMatter(
124+
file,
125+
(fm: Record<string, unknown>) => {
126+
fm.publishedToGroups = [...existingPublish, myGroup];
127+
},
128+
);
133129
};

packages/database/src/lib/files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const addFile = async ({
2525
if (!exists) {
2626
// we should use upsert here for sync issues, but we get obscure rls errors.
2727
const uploadResult = await client.storage.from(ASSETS_BUCKET_NAME).upload(hashvalue, content, {contentType: mimetype});
28-
if (uploadResult.error && !uploadResult.error.message.endsWith(" already exists"))
28+
if (uploadResult.error && (uploadResult.error as any).statusCode !== "409")
2929
throw uploadResult.error;
3030
}
3131
// not doing an upsert because it does not update on conflict

0 commit comments

Comments
 (0)