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