From 282bb1ee46832bb3f7c8e571b3a184dd99e4df04 Mon Sep 17 00:00:00 2001 From: Federico Date: Tue, 12 Jan 2021 00:46:16 -0600 Subject: Avoid embedding large files in `embed-gist-inline` (#3890) --- source/features/embed-gist-inline.tsx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'source/features/embed-gist-inline.tsx') diff --git a/source/features/embed-gist-inline.tsx b/source/features/embed-gist-inline.tsx index 13fc2022..808002a4 100644 --- a/source/features/embed-gist-inline.tsx +++ b/source/features/embed-gist-inline.tsx @@ -21,6 +21,10 @@ async function embedGist(link: HTMLAnchorElement): Promise { try { // Fetch via background.js due to CORB policies const gistData = await browser.runtime.sendMessage({fetchJSON: `${link.href}.json`}); + if (gistData.div.length > 10000) { + info.textContent = ' (too large to embed)'; + return; + } const fileCount: number = gistData.files.length; if (fileCount > 1) { -- cgit v1.2.3