diff options
author | 2021-01-12 00:46:16 -0600 | |
---|---|---|
committer | 2021-01-12 00:46:16 -0600 | |
commit | 282bb1ee46832bb3f7c8e571b3a184dd99e4df04 (patch) | |
tree | eb231c70440846d26e7b57b39b582aacd0dda5ac /source/features/embed-gist-inline.tsx | |
parent | 382b398cbaccbb5a3f7135cf873f1302daf5901e (diff) | |
download | refined-github-282bb1ee46832bb3f7c8e571b3a184dd99e4df04.tar.gz refined-github-282bb1ee46832bb3f7c8e571b3a184dd99e4df04.tar.zst refined-github-282bb1ee46832bb3f7c8e571b3a184dd99e4df04.zip |
Avoid embedding large files in `embed-gist-inline` (#3890)
Diffstat (limited to 'source/features/embed-gist-inline.tsx')
-rw-r--r-- | source/features/embed-gist-inline.tsx | 4 |
1 files changed, 4 insertions, 0 deletions
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<void> { 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) { |