diff options
-rw-r--r-- | src/downloaders.js | 3 | ||||
-rw-r--r-- | todo.txt | 7 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/downloaders.js b/src/downloaders.js index ad322fa..fa1f337 100644 --- a/src/downloaders.js +++ b/src/downloaders.js @@ -3,6 +3,7 @@ const fetch = require('node-fetch') const promisifyProcess = require('./promisify-process') const tempy = require('tempy') const path = require('path') +const sanitize = require('sanitize-filename') const { spawn } = require('child_process') const { promisify } = require('util') @@ -12,7 +13,7 @@ const writeFile = promisify(fs.writeFile) function makeHTTPDownloader() { return function(arg) { const dir = tempy.directory() - const out = dir + '/' + path.basename(arg) + const out = dir + '/' + sanitize(decodeURIComponent(path.basename(arg))) return fetch(arg) .then(response => response.buffer()) diff --git a/todo.txt b/todo.txt index bbb23f2..439181b 100644 --- a/todo.txt +++ b/todo.txt @@ -128,3 +128,10 @@ TODO: Let playlist filter match things lowercase. '72 Minutes Of Fame' should best to prioritize a case-sensitive match before a non-case-sensitive one. Given the input 'FoObAR', prioritize 'FoObAR' over 'Foobar'.) (Done!) + +TODO: Figure out why written track files (when using HTTP downloader) are + URL-encoded. It's probably writing a file based on the href-file name, + rather than the title. That's alright, but maybe we should URL-decode + and then sanitize the href-file name, so that we get 'Foo Bar.mp3' + instead of 'Foo%20Bar.mp3'. + (Done!) |