Unsupported blob pages getting injected (#318)

Fixes #312
This commit is contained in:
Pierre Jacquier
2023-07-14 06:41:11 -04:00
committed by GitHub
parent 3412c1fd69
commit 67aaae56f0

View File

@ -11,6 +11,7 @@ import {
getGithubCommitWithinPullUrlParams,
} from './web'
import gitHubInjection from 'github-injection'
import { isFilenameSupported } from './diff'
const root = createReactRoot(document)
@ -141,9 +142,11 @@ async function run() {
const blobParams = getGithubBlobUrlParams(url)
if (blobParams) {
const { owner, repo, sha, filename } = blobParams
console.log('Found blob diff: ', owner, repo, sha, filename)
await injectBlob(owner, repo, sha, filename, window.document)
return
if (isFilenameSupported(filename)) {
console.log('Found supported blob: ', owner, repo, sha, filename)
await injectBlob(owner, repo, sha, filename, window.document)
return
}
}
}