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

express-open-in-editor

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-open-in-editor - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

7

HISTORY.md

@@ -0,4 +1,9 @@

## 3.0.2 (September 21, 2017)
- Fixed crash on send error in response
- Fixed messages
## 3.0.1 (September 21, 2017)
- Fixed exception on configure error output
- Fixed crash on configure error output

@@ -5,0 +10,0 @@ ## 3.0.0 (September 21, 2017)

64

index.js

@@ -7,42 +7,42 @@ var parseUrl = require('parseurl');

function fail(code, message) {
res.statusCode = code;
res.end(MESSAGE_PREFIX + message);
function fail(res, code, message) {
res.statusCode = code;
res.end(MESSAGE_PREFIX + message);
}
module.exports = function(options) {
var opener = configure(options || {}, function(err) {
console.warn(MESSAGE_PREFIX + ' configure error: ', err);
});
var opener = configure(options || {}, function(err) {
console.warn(MESSAGE_PREFIX + 'Configure error:', err);
});
return function openInEditor(req, res, next) {
if (!opener) {
var msg = MESSAGE_PREFIX + 'Request to open file failed, editor is not set up';
console.warn(msg);
return fail(res, 400, msg);
}
return function openInEditor(req, res, next) {
if (!opener) {
var msg = 'Request to open file failed, editor is not set up';
console.warn(MESSAGE_PREFIX + msg);
return fail(res, 400, msg);
}
var parsedUrl = parseUrl(req);
var filename = querystring.parse(parsedUrl.query).file;
var parsedUrl = parseUrl(req);
var filename = querystring.parse(parsedUrl.query).file;
if (!filename) {
return fail(res, 400, 'Parameter missed: file');
}
if (!filename) {
return fail(res, 400, 'Parameter missed: file');
}
// temporary solution
// should take in account options.base
filename = path
.resolve('/', filename)
.replace(/^[a-z]+:/i, ''); // cut drive from path on Windows platform
// temporary solution
// should take in account options.base
filename = path
.resolve('/', filename)
.replace(/^[a-z]+:/i, ''); // cut drive from path on Windows platform
opener.open(filename).then(
function() {
res.statusCode = 200;
res.end('OK');
},
function(e) {
fail(res, 500, 'ERROR: ' + e);
}
);
};
opener.open(filename).then(
function() {
res.statusCode = 200;
res.end('OK');
},
function(e) {
fail(res, 500, 'ERROR: ' + e);
}
);
};
};
{
"name": "express-open-in-editor",
"version": "3.0.1",
"version": "3.0.2",
"description": "Express middleware to open file in editor",

@@ -20,3 +20,11 @@ "author": "Roman Dvornov <rdvornov@gmail.com>",

},
"scripts": {}
"scripts": {
"test": "mocha --reporter dot",
"lint": "jscs index.js test"
},
"devDependencies": {
"express": "^4.15.4",
"jscs": "^3.0.7",
"mocha": "^3.5.3"
}
}

Sorry, the diff of this file is not supported yet

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