From 011bdc4617490da7f95a7711d5fcf5d16745dd44 Mon Sep 17 00:00:00 2001 From: Henry Oswald Date: Fri, 24 Oct 2014 12:01:35 +0100 Subject: [PATCH] explicitly set the file types to delete the wild card version can get mixed up with app.del '/project/:project_id/contents/*', httpAuth, TpdsController.deleteProjectContents --- .../Features/Editor/EditorHttpController.coffee | 12 ++++++++++++ services/web/app/coffee/router.coffee | 5 ++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee index 86acfb79fe..97f61e9b86 100644 --- a/services/web/app/coffee/Features/Editor/EditorHttpController.coffee +++ b/services/web/app/coffee/Features/Editor/EditorHttpController.coffee @@ -57,6 +57,18 @@ module.exports = EditorHttpController = return next(error) if error? res.send 204 + deleteDoc: (req, res, next)-> + req.params.entity_type = "doc" + EditorHttpController.deleteEntity(req, res, next) + + deleteFile: (req, res, next)-> + req.params.entity_type = "file" + EditorHttpController.deleteEntity(req, res, next) + + deleteFolder: (req, res, next)-> + req.params.entity_type = "folder" + EditorHttpController.deleteEntity(req, res, next) + deleteEntity: (req, res, next) -> project_id = req.params.Project_id entity_id = req.params.entity_id diff --git a/services/web/app/coffee/router.coffee b/services/web/app/coffee/router.coffee index 31932fdc23..8538e16bf8 100644 --- a/services/web/app/coffee/router.coffee +++ b/services/web/app/coffee/router.coffee @@ -103,7 +103,10 @@ module.exports = class Router app.post '/project/:Project_id/:entity_type/:entity_id/rename', SecurityManager.requestCanModifyProject, EditorHttpController.renameEntity app.post '/project/:Project_id/:entity_type/:entity_id/move', SecurityManager.requestCanModifyProject, EditorHttpController.moveEntity - app.delete '/project/:Project_id/:entity_type/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteEntity + + app.delete '/project/:Project_id/file/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteFile + app.delete '/project/:Project_id/doc/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteDoc + app.delete '/project/:Project_id/folder/:entity_id', SecurityManager.requestCanModifyProject, EditorHttpController.deleteFolder app.post '/project/:Project_id/compile', SecurityManager.requestCanAccessProject, CompileController.compile app.get '/Project/:Project_id/output/output.pdf', SecurityManager.requestCanAccessProject, CompileController.downloadPdf