Skip to content

Commit

Permalink
Merge 93d9587 into 8d668f5
Browse files Browse the repository at this point in the history
  • Loading branch information
kuu committed Jul 30, 2019
2 parents 8d668f5 + 93d9587 commit 9e47c8e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion file.js
Expand Up @@ -28,7 +28,12 @@ function storeData({uri, parentUri, data}, {inputDir, outputDir}) {
() => null
);
if (obj) {
localPath = path.join(outputDir, obj.pathname);
if (obj.protocol === 'file:') {
const pathname = path.relative(inputDir, obj.pathname);
localPath = path.join(outputDir, pathname);
} else {
localPath = path.join(outputDir, obj.pathname);
}
} else {
const pathname = path.relative(inputDir, path.join(parentUri, uri));
localPath = path.join(outputDir, pathname);
Expand Down
4 changes: 2 additions & 2 deletions test/spec/file.spec.js
Expand Up @@ -92,9 +92,9 @@ test.cb('file.storeData.Stream', t => {
}
};

storeData({uri: 'ghi.mp4', parentUri: 'file:///path/to/main.m3u8', data}, {inputDir: '/', outputDir: '/abc/def/'})
storeData({uri: 'ghi.mp4', parentUri: 'file:///path/to/main.m3u8', data}, {inputDir: '/path/to', outputDir: '/abc/def/'})
.then(destPath => {
t.is(destPath, '/abc/def/path/to/ghi.mp4');
t.is(destPath, '/abc/def/ghi.mp4');
t.is(spyCreateWriteStream.callCount, 1);
t.end();
});
Expand Down

0 comments on commit 9e47c8e

Please sign in to comment.