Skip to content

Commit f2bdd85

Browse files
author
Richard Smith-Unna
authored
Merge pull request #86 from tarrow/santiseFileNames
sanitize creation of folder
2 parents 43b7516 + 0be76de commit f2bdd85

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

bin/quickscrape.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ var program = require('commander')
1111
, Scraper = thresher.Scraper
1212
, ep = require('../lib/eventparse.js')
1313
, loglevels = require('../lib/loglevels.js')
14-
, outformat = require('../lib/outformat.js');
14+
, outformat = require('../lib/outformat.js')
15+
, sanitize = require('sanitize-filename');
1516

1617

1718
var pjson = require('../package.json');
@@ -223,7 +224,7 @@ var processUrl = function(url) {
223224

224225
// url-specific output dir
225226
var dir = program.numberdirs ? ('' + i) : url.replace(/\/+/g, '_').replace(/:/g, '');
226-
dir = path.join(tld, dir);
227+
dir = sanitize(path.join(tld, dir));
227228
if (!fs.existsSync(dir)) {
228229
log.debug('creating output directory: ' + dir);
229230
fs.mkdirSync(dir);

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"moment": "~2.10.2",
3232
"thresher": "^0.1.11",
3333
"which": "~1.0.5",
34-
"winston": "~1.0.0"
34+
"winston": "~1.0.0",
35+
"sanitize-filename": "1.6.0"
3536
},
3637
"bin": {
3738
"quickscrape": "bin/quickscrape.js"

0 commit comments

Comments
 (0)