New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mvcjs

Package Overview
Dependencies
Maintainers
1
Versions
123
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mvcjs - npm Package Compare versions

Comparing version 0.1.0-beta-10 to 0.1.0-beta-11

44

framework/core/assets.js

@@ -8,2 +8,4 @@ "use strict";

mime = di.load('mime-types'),
fs = di.load('fs'),
Promise = di.load('promise'),
component = di.load('core/component'),

@@ -50,5 +52,4 @@ logger = component.get('core/logger'),

var maxAge = 60 * 60 * 24 * 30 * 12, // one year
filePath = this.config.path + api.parsedUrl.pathname,
mimeType,
file;
filePath = di.normalizePath(this.config.path + api.parsedUrl.pathname),
mimeType;

@@ -60,23 +61,28 @@

logger.print('MimeType', mimeType, filePath);
return false;
return Promise.resolve(false);
}
file = this.readFile(filePath);
return new Promise(function (resolve, reject) {
if (api.getMethod() !== 'GET') {
return reject(new error.HttpError(500, {path: filePath}, 'Assets are accessible only via GET request'));
}
this.readFile(filePath, function (err, file) {
if (err) {
return reject(err);
}
api.addHeader('Content-Type', mimeType);
api.addHeader('Cache-Control', 'public, max-age=' + ~~(maxAge));
api.addHeader('ETag', etag(file));
api.addHeader('Content-Type', mimeType);
api.addHeader('Cache-Control', 'public, max-age=' + ~~(maxAge));
api.addHeader('ETag', etag(file));
if (api.isHeaderCacheUnModified()) {
return resolve(api.sendNoChange());
}
if (api.getMethod() !== 'GET') {
throw new error.HttpError(500, {path: filePath}, 'Assets are accessible only via GET request');
} else if (api.isHeaderCacheUnModified()) {
api.sendNoChange();
}
logger.print('MimeType', mimeType, filePath);
resolve(file);
});
}.bind(this));
logger.print('MimeType', mimeType, filePath);
return file;
},

@@ -102,4 +108,4 @@ /**

*/
readFile: function Assets_readFile(filePath) {
return di.readFileSync(filePath);
readFile: function Assets_readFile() {
return fs.readFile.apply(fs, arguments);
}

@@ -106,0 +112,0 @@ });

@@ -5,3 +5,3 @@ {

"description": "Powerful lightweight mvc framework for nodejs",
"version": "0.1.0-beta-10",
"version": "0.1.0-beta-11",
"dependencies" : {

@@ -8,0 +8,0 @@ "mongoose": "3.8.x",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc