Skip to content

Commit

Permalink
refactor(serve-static): use c.req.path instead of url.pathname (#166
Browse files Browse the repository at this point in the history
)
  • Loading branch information
yusukebe authored Apr 26, 2024
1 parent d62cbbb commit d6aa4df
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/serve-static.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ export const serveStatic = (options: ServeStaticOptions = { root: '' }): Middlew
return next()
}

const url = new URL(c.req.url)

const filename = options.path ?? decodeURIComponent(url.pathname)
const filename = options.path ?? decodeURIComponent(c.req.path)
let path = getFilePath({
filename: options.rewriteRequestPath ? options.rewriteRequestPath(filename) : filename,
root: options.root,
Expand Down

0 comments on commit d6aa4df

Please sign in to comment.