From 6f3c263cd76f20a52dd40f84970583b013286ef9 Mon Sep 17 00:00:00 2001 From: Mikael Finstad Date: Fri, 15 Nov 2024 11:14:21 +0800 Subject: [PATCH] resolve relative path --- src/app.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app.ts b/src/app.ts index 995ea90..e7b97fb 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,7 +1,7 @@ import express, { Response } from 'express'; import Formidable from 'formidable'; import { createReadStream } from 'node:fs'; -import { join, basename, relative } from 'node:path'; +import { join, basename, relative, resolve } from 'node:path'; import assert from 'node:assert'; import * as fs from 'node:fs/promises'; import morgan from 'morgan'; @@ -34,7 +34,7 @@ export default ({ sharedPath: sharedPathIn, port, maxUploadSize, zipCompressionL devMode: boolean, }) => { // console.log({ sharedPath: sharedPathIn, port, maxUploadSize, zipCompressionLevel }); - const sharedPath = sharedPathIn || process.cwd(); + const sharedPath = sharedPathIn ? resolve(sharedPathIn) : process.cwd(); function arePathsEqual(path1: string, path2: string) { return relative(path1, path2) === '';