Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ var util = require('util')
, fs = require('fs')
, spawn = require('./spawn')
, errors = require('./errors')
, cwd = process.cwd();
, cwd = process.cwd()
, path = require('path');

/**
* Make some curl opts friendlier.
Expand Down Expand Up @@ -236,7 +237,13 @@ exports.request = function (options, callback) {

if (options.file) {
cmd = 'cat';
args = [options.file];
var rootDirectory = path.resolve(cwd, './');
var filename = path.join(rootDirectory, options.file);
if (filename.indexOf(rootDirectory) !== 0) {
// trying to sneak out of the root directory?
return
}
args = [filename];
}

//Simulate the spawn?
Expand Down