-
Notifications
You must be signed in to change notification settings - Fork 93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix #268: Revert "fix #246: remove any double quotes or single quotes… #278
Merged
silkentrance
merged 2 commits into
raszi:master
from
mbargiel:feature/fix-268-revert-sanitize-name
Aug 26, 2022
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
const | ||
assert = require('assert'), | ||
os = require('os'), | ||
path = require('path'), | ||
inbandStandardTests = require('./name-inband-standard'), | ||
tmp = require('../lib/tmp'); | ||
|
||
|
@@ -63,15 +64,15 @@ describe('tmp', function () { | |
}); | ||
}); | ||
}); | ||
describe('on issue #246', function () { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, tests must stay in place, yet test for the presence of the quotes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see a831713. |
||
describe('on issue #268', function () { | ||
const origfn = os.tmpdir; | ||
it('must produce correct name on os.tmpdir() returning path that includes double quotes', function (done) { | ||
it(`should not alter ${isWindows ? 'invalid' : 'valid'} path on os.tmpdir() returning path that includes double quotes`, function (done) { | ||
const tmpdir = isWindows ? '"C:\\Temp With Spaces"' : '"/tmp with spaces"'; | ||
os.tmpdir = function () { return tmpdir; }; | ||
tmp.tmpName(function (err, name) { | ||
const index = name.indexOf(path.sep + tmpdir + path.sep); | ||
try { | ||
assert.ok(name.indexOf('"') === -1); | ||
assert.ok(name.startsWith(tmpdir.replace(/["']/g, ''))); | ||
assert.ok(index > 0, `${tmpdir} should have been a subdirectory name in ${name}`); | ||
} catch (err) { | ||
return done(err); | ||
} finally { | ||
|
@@ -80,13 +81,13 @@ describe('tmp', function () { | |
done(); | ||
}); | ||
}); | ||
it('must produce correct name on os.tmpdir() returning path that includes single quotes', function (done) { | ||
it('should not alter valid path on os.tmpdir() returning path that includes single quotes', function (done) { | ||
const tmpdir = isWindows ? '\'C:\\Temp With Spaces\'' : '\'/tmp with spaces\''; | ||
os.tmpdir = function () { return tmpdir; }; | ||
tmp.tmpName(function (err, name) { | ||
const index = name.indexOf(path.sep + tmpdir + path.sep); | ||
try { | ||
assert.ok(name.indexOf('\'') === -1); | ||
assert.ok(name.startsWith(tmpdir.replace(/["']/g, ''))); | ||
assert.ok(index > 0, `${tmpdir} should have been a subdirectory name in ${name}`); | ||
} catch (err) { | ||
return done(err); | ||
} finally { | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you leave these tests and make these so that they check for the presence of the single quotes and double quotes instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Absolutely! I wasn't sure which you would have preferred between simply reverting or keeping the tests but amended to serve as regression tests. I'll do this when I can, either tonight or tomorrow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see a831713.