diff --git a/assets/files/shrink_url.sh b/src/assets/files/shrink_url.sh similarity index 100% rename from assets/files/shrink_url.sh rename to src/assets/files/shrink_url.sh diff --git a/assets/files/upload_file.sh b/src/assets/files/upload_file.sh similarity index 100% rename from assets/files/upload_file.sh rename to src/assets/files/upload_file.sh diff --git a/src/controllers/FileController.ts b/src/controllers/FileController.ts index ce1cb77..7873d97 100644 --- a/src/controllers/FileController.ts +++ b/src/controllers/FileController.ts @@ -2,6 +2,7 @@ import config from "config"; import {NextFunction, Request, Response} from "express"; import formidable from "formidable"; import * as fs from "fs"; +import path from "path"; import {RequireAuthMiddleware, RequireRequestAuthMiddleware} from "swaf/auth/AuthComponent"; import {route} from "swaf/common/Routing"; import Controller from "swaf/Controller"; @@ -43,7 +44,7 @@ export default class FileController extends Controller { } protected async downloadLinuxScript(req: Request, res: Response): Promise { - res.download('assets/files/upload_file.sh', 'upload_file.sh'); + res.download(path.resolve(__dirname, '..', 'assets/files/upload_file.sh'), 'upload_file.sh'); } protected async postFileFrontend(req: Request, res: Response): Promise { diff --git a/src/controllers/URLRedirectController.ts b/src/controllers/URLRedirectController.ts index cadc643..5552adb 100644 --- a/src/controllers/URLRedirectController.ts +++ b/src/controllers/URLRedirectController.ts @@ -1,5 +1,6 @@ import config from "config"; import {NextFunction, Request, Response} from "express"; +import path from "path"; import {RequireAuthMiddleware, RequireRequestAuthMiddleware} from "swaf/auth/AuthComponent"; import {route} from "swaf/common/Routing"; import Controller from "swaf/Controller"; @@ -25,7 +26,7 @@ export default class URLRedirectController extends Controller { } protected async downloadLinuxScript(req: Request, res: Response): Promise { - res.download('assets/files/shrink_url.sh', 'shrink_url.sh'); + res.download(path.resolve(__dirname, '..', 'assets/files/shrink_url.sh'), 'shrink_url.sh'); } protected async addUrlFrontend(req: Request, res: Response, next: NextFunction): Promise {