Skip to content

Commit

Permalink
fix: fix isImportRequest check on request with queies
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed May 3, 2020
1 parent d0b896f commit 348a7e8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { promises as fs } from 'fs'
import LRUCache from 'lru-cache'
import { Context } from 'koa'
import { Readable } from 'stream'
import { URL } from 'url'
const getETag = require('etag')

const imageRE = /\.(png|jpe?g|gif|svg)(\?.*)?$/
Expand All @@ -23,7 +24,7 @@ export const isStaticAsset = (file: string) => {
* as well.
*/
export const isImportRequest = (ctx: Context) => {
const referer = ctx.get('referer')
const referer = new URL(ctx.get('referer')).pathname
return /\.\w+$/.test(referer) && !referer.endsWith('.html')
}

Expand Down

0 comments on commit 348a7e8

Please sign in to comment.