Skip to content
This repository has been archived by the owner on Jul 3, 2019. It is now read-only.

Commit

Permalink
Revert "fix(deps): update tar-fs with the special characters patch (#102
Browse files Browse the repository at this point in the history
)"

This reverts commit ed43aa3.

This commit is necessary because @mcibique did not respond to
#107 after more than 3 months and
several pings. This is therefore the only commit that could not
be relicensed from CC0.
  • Loading branch information
zkat committed Nov 15, 2017
1 parent ba6b3e0 commit 9e26894
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 40 deletions.
35 changes: 0 additions & 35 deletions test/extract-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const fs = BB.promisifyAll(require('fs'))
const mkdirp = BB.promisify(require('mkdirp'))
const mockTar = require('./util/mock-tarball')
const npmlog = require('npmlog')
const path = require('path')
const pipe = BB.promisify(require('mississippi').pipe)
const test = require('tap').test

Expand Down Expand Up @@ -264,37 +263,3 @@ test('accepts dmode/fmode/umask opts', {
})
})

test('extracts filenames with special characters', {
skip: process.platform !== 'win32' &&
'special character conversion is only needed on Windows'
}, t => {
const tarStream = fs.createReadStream('../../fixtures/special-characters.tgz')
return pipe(tarStream, extractStream('.')).then(() => {
const fileNamesUnderTest = [
'filename:with:colons',
'filename<with<less<than<signs',
'filename>with>more>than>signs',
'filename|with|pipes',
'filename?with?question?marks'
].map(fileName => ({
rawFileName: fileName,
expectedFileName: ':<>|?'.split('').reduce((s, c) => {
return s.split(c).join(String.fromCharCode(0xf000 + c.charCodeAt(0)))
}, fileName),
expectedContent: fileName
}))

return BB.all(fileNamesUnderTest.map(fileNameUnderTest => {
const filePath = fileNameUnderTest.expectedFileName
return fs.readFileAsync(filePath, 'utf8').then(data => {
t.equal(
data.trim(),
fileNameUnderTest.expectedContent,
`Filename "${
fileNameUnderTest.rawFileName
}" was sanitized and content left intact`
)
})
}))
})
})
9 changes: 4 additions & 5 deletions test/fixtures/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
This directory contains a number of pre-generated files and directories used
by various tests. This file documents which tests use each file, and what for.

| File | User(s) | Note |
|---------------------------|------------------------------|-----------------------------------------------------------|
| `has-shrinkwrap.tgz` | `util.extract-shrinkwrap.js` | used to test streaming shrinkwrap extraction. |
| `no-shrinkwrap.tgz` | `util.extract-shrinkwrap.js` | used to test streaming shrinkwrap extraction. |
| `special-characters.tgz` | `util.extract-shrinkwrap.js` | used to test sanitization of special characters on win32. |
| File | User(s) | Note |
|----------------------|------------------------------|-----------------------------------------------|
| `has-shrinkwrap.tgz` | `util.extract-shrinkwrap.js` | used to test streaming shrinkwrap extraction. |
| `no-shrinkwrap.tgz` | `util.extract-shrinkwrap.js` | used to test streaming shrinkwrap extraction. |
Binary file removed test/fixtures/special-characters.tgz
Binary file not shown.

0 comments on commit 9e26894

Please sign in to comment.