Skip to content

Commit

Permalink
fix(editor): crash on invalid directory
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Feb 2, 2019
1 parent c5c6f34 commit bc60899
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/controllers/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ editor.page = function (req, res) {
editor.getAssets = function (req, res) {
var imageExts = ['.gif', '.png', '.jpg', '.jpeg', '.ico', '.bmp']

fs.ensureDirSync(path.join(__dirname, '../../public/uploads/assets/upload'))

fs.readdir(path.join(__dirname, '../../public/uploads/assets/upload'), function (err, files) {
if (err) return res.status(400).json({ success: false, error: err })

Expand Down

0 comments on commit bc60899

Please sign in to comment.