Skip to content

Commit

Permalink
remove .at
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Sep 6, 2023
1 parent aa9b53a commit 2769b2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async function fastifyStatic (fastify, opts) {

if (!opts.prefixAvoidTrailingSlash) {
prefix =
prefix.at(-1) === '/'
prefix[prefix.length - 1] === '/'
? prefix
: prefix + '/'
}
Expand Down Expand Up @@ -540,7 +540,7 @@ function getRedirectUrl (url) {
try {
const parsed = new URL(url, 'http://localhost.com/')
const parsedPathname = parsed.pathname
return parsedPathname + (parsedPathname.at(-1) !== '/' ? '/' : '') + (parsed.search || '')
return parsedPathname + (parsedPathname[parsedPathname.length - 1] !== '/' ? '/' : '') + (parsed.search || '')
} catch (error) {
// the try-catch here is actually unreachable, but we keep it for safety and prevent DoS attack
/* istanbul ignore next */
Expand Down

0 comments on commit 2769b2c

Please sign in to comment.