From fac0433557ac9556d48a9bb2421ac96ff220786d Mon Sep 17 00:00:00 2001 From: jw255 Date: Mon, 23 Apr 2018 13:54:17 +0100 Subject: fixed various tests and errors --- src/FileRouter.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/FileRouter.ts') diff --git a/src/FileRouter.ts b/src/FileRouter.ts index c8884f7..b4cd403 100644 --- a/src/FileRouter.ts +++ b/src/FileRouter.ts @@ -589,7 +589,7 @@ const postProjectName: Middleware = async( if (project == null) { logger.debug('Adding new project'); const file: File = new File({ - uuid: uuid.generate(), + uuid: uuid.generate() }); file.mimetype = 'inode/directory'; file.name = ''; @@ -662,9 +662,7 @@ const getFileFromPath: (req: Request, res: Response) => Promise = async( } return j; }; - const path: string = req.path.substring(nth(req.path, '/', 4) + 1); - res.locals.path = path; logger.debug(`Searching for path '${res.locals.path}'`); // Split path into parts @@ -674,7 +672,7 @@ const getFileFromPath: (req: Request, res: Response) => Promise = async( ? fileNames[fileNames.length - 1] : ''; const project: Project | null = res.locals.project; - if (project == null) { + if (!project) { // Project should have been found by previous precondition logger.debug('Project was not found: skipping finding file'); throw new RequestError(404, 'project_not_found'); @@ -1107,6 +1105,6 @@ export class FileRouter { } // Create the FileRouter, and export its configured Express.Router -const fileRoutes: FileRouter = new FileRouter(); +//const fileRoutes: FileRouter = new FileRouter(); -export default fileRoutes.router; +export default new FileRouter().router; -- cgit v1.2.1