Skip to content

fix #182 fileSync takes empty string postfix option#183

Merged
silkentrance merged 1 commit intoraszi:masterfrom
gutte:master
Jan 10, 2019
Merged

fix #182 fileSync takes empty string postfix option#183
silkentrance merged 1 commit intoraszi:masterfrom
gutte:master

Conversation

@gutte
Copy link
Copy Markdown

@gutte gutte commented Jan 10, 2019

{postfix :""} gives filename without file extension.

@silkentrance
Copy link
Copy Markdown
Collaborator

@gutte nice find. the same is true for the async file method. perhaps you want to fix it there, too?

@silkentrance
Copy link
Copy Markdown
Collaborator

@gutte some tests against this issue would be nice, too.

@silkentrance
Copy link
Copy Markdown
Collaborator

Looking at _generateTmpName(opts), this seems to be the original and desired behaviour, if the user decides to pass in an empty postfix, then the file shall have no '.tmp' extension, see at the very end of the _generateTmpName(opts) function, where the name is assembled from an array.

@silkentrance
Copy link
Copy Markdown
Collaborator

Okay, here was inverse logic in place. The issue correctly describes the wrong behaviour.

@silkentrance silkentrance merged commit 77d8e7e into raszi:master Jan 10, 2019
@raszi
Copy link
Copy Markdown
Owner

raszi commented Jan 10, 2019

Good find, but we'll need to add tests for this.

@gutte
Copy link
Copy Markdown
Author

gutte commented Jan 11, 2019

Hey, yes sorry for the short pull request description. The issue description is clearer.

The behavior for fallback to the default postfix (.tmp) should now be the same for sync and async functions.

@silkentrance
Copy link
Copy Markdown
Collaborator

silkentrance commented Jan 12, 2019

I am currently doing the tests for this, both for async/sync file and also for async/sync tmpName.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants