Skip to content

Commit

Permalink
Add limitations to file uploads
Browse files Browse the repository at this point in the history
  • Loading branch information
mrvautin committed Jun 1, 2018
1 parent 6345ef8 commit 65b18cf
Show file tree
Hide file tree
Showing 5 changed files with 232 additions and 34 deletions.
11 changes: 11 additions & 0 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ const restrictedRoutes = [
{route: '/admin/file/delete', response: 'json'}
];

// Allowed mime types for product images
exports.allowedMimeType = [
'image/jpeg',
'image/png',
'image/gif',
'image/bmp',
'image/webp'
];

exports.fileSizeLimit = 10485760;

// common functions
exports.restrict = (req, res, next) => {
exports.checkLogin(req, res, next);
Expand Down
188 changes: 174 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "express-cart",
"version": "1.1.6",
"version": "1.1.7",
"description": "A fully functioning Node.js shopping cart with Stripe, PayPal and Authorize.net payments.",
"private": false,
"scripts": {
Expand All @@ -27,6 +27,8 @@
"html-entities": "^1.2.0",
"lodash": "^4.13.1",
"lunr": "^2.1.5",
"mime-db": "^1.33.0",
"mime-type": "^3.0.5",
"moment": "^2.15.2",
"mongodb": "2.2.3",
"morgan": "^1.9.0",
Expand Down
Loading

0 comments on commit 65b18cf

Please sign in to comment.