Skip to content
This repository has been archived by the owner on Jun 27, 2019. It is now read-only.

Commit

Permalink
Added server side support for Exporting Files
Browse files Browse the repository at this point in the history
Signed-off-by: Kamidi Preetham <kamidi@live.com>
  • Loading branch information
Kamidi Preetham committed Jul 8, 2016
1 parent 92490f7 commit fe3688a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions server/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,20 @@
})
});

router.get('/api/file/download', function(req, res) {
var file_path = req.query.file;
if ( file_path.search('soletta-dev-app/repos') > -1 ) {
var file_name = file_path.split('/').pop();
if (fs.statSync(file_path)) {
res.download(file_path, file_name);
} else {
res.sendStatus(400);
}
} else {
res.sendStatus(400);
}
});

router.post('/api/git/repo/delete/file', function (req, res) {
var file_path = req.body.params.file_path;
if (!file_path) {
Expand Down

0 comments on commit fe3688a

Please sign in to comment.