Skip to content

Commit

Permalink
fix: use full mime lookup in cached read (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
undoZen authored May 29, 2020
1 parent 0752910 commit 7a59ec8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node/utils/fsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import LRUCache from 'lru-cache'
import { Context } from 'koa'
import { Readable } from 'stream'
import { seenUrls } from '../server/serverPluginServeStatic'
import mime from 'mime-types'

const getETag = require('etag')

Expand All @@ -29,7 +30,7 @@ export async function cachedRead(
const cached = moduleReadCache.get(file)
if (ctx) {
ctx.set('Cache-Control', 'no-cache')
ctx.type = path.extname(file) || 'js'
ctx.type = mime.lookup(path.extname(file)) || 'js'
}
if (cached && cached.lastModified === lastModified) {
if (ctx) {
Expand Down

0 comments on commit 7a59ec8

Please sign in to comment.