chore(back/scripts): move linux scripts to new assets folder

This commit is contained in:
Alice Gaudon 2022-03-05 09:06:58 +01:00
parent 27f760d503
commit c2182dbbca
4 changed files with 4 additions and 2 deletions

View File

@ -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<void> {
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<void> {

View File

@ -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<void> {
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<void> {