From f3d1b01ccb3230c62b86cf9bbc1deacc0f0643f3 Mon Sep 17 00:00:00 2001 From: myl7 Date: Fri, 10 Sep 2021 04:48:41 +0800 Subject: [PATCH] fix index page 500 error By removing trailing slash for drive api --- pages/api/index.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/api/index.ts b/pages/api/index.ts index b7a03da..37d8a37 100644 --- a/pages/api/index.ts +++ b/pages/api/index.ts @@ -8,10 +8,11 @@ import { compareHashedToken } from '../../utils/tools' const basePath = pathPosix.resolve('/', apiConfig.base) const encodePath = (path: string) => { - const encodedPath = pathPosix.join(basePath, pathPosix.resolve('/', path)) + let encodedPath = pathPosix.join(basePath, pathPosix.resolve('/', path)) if (encodedPath === '/' || encodedPath === '') { return '' } + encodedPath = encodedPath.replace(/\/$/, '') return `:${encodeURIComponent(encodedPath)}` }