Merge pull request #105 from myl7/dev

Fix index page 500 error
This commit is contained in:
Spencer Woo
2021-09-14 09:10:42 +01:00
committed by GitHub
+2 -1
View File
@@ -8,10 +8,11 @@ import { compareHashedToken } from '../../utils/tools'
const basePath = pathPosix.resolve('/', apiConfig.base) const basePath = pathPosix.resolve('/', apiConfig.base)
const encodePath = (path: string) => { const encodePath = (path: string) => {
const encodedPath = pathPosix.join(basePath, pathPosix.resolve('/', path)) let encodedPath = pathPosix.join(basePath, pathPosix.resolve('/', path))
if (encodedPath === '/' || encodedPath === '') { if (encodedPath === '/' || encodedPath === '') {
return '' return ''
} }
encodedPath = encodedPath.replace(/\/$/, '')
return `:${encodeURIComponent(encodedPath)}` return `:${encodeURIComponent(encodedPath)}`
} }