Skip to content

Commit 8401c57

Browse files
authored
ENG-1451 give feedback for oversize assets (#882)
1 parent cd2549d commit 8401c57

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/obsidian/src/utils/publishNode.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type { FrontMatterCache, TFile } from "obsidian";
2+
import { Notice } from "obsidian";
23
import type { default as DiscourseGraphPlugin } from "~/index";
34
import { getLoggedInClient, getSupabaseContext } from "./supabaseContext";
45
import { addFile } from "@repo/database/lib/files";
@@ -371,6 +372,13 @@ export const publishNodeToGroup = async ({
371372
for (const attachment of attachments) {
372373
const mimetype = mime.lookup(attachment.path) || "application/octet-stream";
373374
if (mimetype.startsWith("text/")) continue;
375+
// Do not use standard upload for large files
376+
if (attachment.stat.size >= 6 * 1024 * 1024) {
377+
new Notice(
378+
`Asset file ${attachment.path} is larger than 6Mb and will not be uploaded`,
379+
);
380+
continue;
381+
}
374382
existingFiles.push(attachment.path);
375383
const existingRef = existingReferencesByPath[attachment.path];
376384
if (

0 commit comments

Comments
 (0)