Skip to content
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 tempy.file() always adds extension-dot . even if no extension is given #19

Merged

Conversation

KSR-Yasuda
Copy link
Contributor

Without either options.name or options.extension,
tempy.file() returns a filename with trailing . .

> tempy.file();
/tmp/4271ee202f7f5382cb8d1226c8dc89a4.

According to readme.md, this is not expected.

For now, skip . if the extension is nullish (undefined or null).
Other falsy (but non-nullish) values (e.g. false, 0, NaN, "") would be intended.

@KSR-Yasuda KSR-Yasuda changed the title Bugfix/file extension with no option Bug: tempy.file() always adds extension-dot (.) even if no extension is given Jan 10, 2020
@sindresorhus
Copy link
Owner

Thanks for catching that. Can you fix the lint issue and add a test?

@KSR-Yasuda
Copy link
Contributor Author

Replaced the nullish checks with light-equal (optinos.extension == null) with deep-equal (=== undefined and === null).

@KSR-Yasuda
Copy link
Contributor Author

Added test.

@sindresorhus sindresorhus changed the title Bug: tempy.file() always adds extension-dot (.) even if no extension is given Fix tempy.file() always adds extension-dot . even if no extension is given Feb 12, 2020
@sindresorhus sindresorhus merged commit 4ecbd80 into sindresorhus:master Feb 12, 2020
@sindresorhus
Copy link
Owner

Thanks :)

bors bot added a commit to IMA-WorldHealth/sunfish that referenced this pull request Feb 12, 2020
45: Update tempy to the latest version 🚀 r=jniles a=greenkeeper[bot]


## The dependency [tempy](https://github.com/sindresorhus/tempy) was updated from `0.3.0` to `0.4.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

**Publisher:** [sindresorhus](https://www.npmjs.com/~sindresorhus)
**License:** MIT

<details>
<summary>Release Notes for v0.4.0</summary>

<h3>Breaking</h3>
<ul>
<li>Require Node.js 10  <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/sindresorhus/tempy/commit/9f815c2b4498c89899f0efe0b2c31494e6a250c6/hovercard" href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/9f815c2b4498c89899f0efe0b2c31494e6a250c6"><tt>9f815c2</tt></a></li>
</ul>
<h3>Fixes</h3>
<ul>
<li>Fix <code>tempy.file()</code> always adds extension-dot <code>.</code> even if no extension is given (<a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="547826646" data-permission-text="Issue title is private" data-url="sindresorhus/tempy#19" data-hovercard-type="pull_request" data-hovercard-url="/sindresorhus/tempy/pull/19/hovercard" href="https://urls.greenkeeper.io/sindresorhus/tempy/pull/19">#19</a>)  <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/sindresorhus/tempy/commit/4ecbd80ce026e6d36ab5cecfa7a08f4b431e7def/hovercard" href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/4ecbd80ce026e6d36ab5cecfa7a08f4b431e7def"><tt>4ecbd80</tt></a></li>
</ul>
<p><a class="commit-link" href="https://urls.greenkeeper.io/sindresorhus/tempy/compare/v0.3.0...v0.4.0"><tt>v0.3.0...v0.4.0</tt></a></p>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 6 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/a2c71980e1e2014dbf6a8e8eb6e445e2d99cb18c"><code>a2c7198</code></a> <code>0.4.0</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/9f815c2b4498c89899f0efe0b2c31494e6a250c6"><code>9f815c2</code></a> <code>Require Node.js 10</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/4ecbd80ce026e6d36ab5cecfa7a08f4b431e7def"><code>4ecbd80</code></a> <code>Fix <code>tempy.file()</code> always adds extension-dot <code>.</code> even if no extension is given (#19)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/c5aa7eeb361e8fd90926c203c6c6c6eaa474b228"><code>c5aa7ee</code></a> <code>Upgrade engines field to Node.js &gt;=8.3 support (#18)</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/38433be09a1f5b0108ec3622de078ec9c5098062"><code>38433be</code></a> <code>Create funding.yml</code></li>
<li><a href="https://urls.greenkeeper.io/sindresorhus/tempy/commit/828c04c0c38e37c9e95ff7685e0395356654b751"><code>828c04c</code></a> <code>Update readme cleanup explanation (#6)</code></li>
</ul>
<p>See the <a href="https://urls.greenkeeper.io/sindresorhus/tempy/compare/8958de57554b06f1dceff8cd5f969aee57e0e056...a2c71980e1e2014dbf6a8e8eb6e445e2d99cb18c">full diff</a></p>
</details>

---

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴



Co-authored-by: greenkeeper[bot] <23040076+greenkeeper[bot]@users.noreply.github.com>
lPadier added a commit to lPadier/jsvu that referenced this pull request May 23, 2020
Tempy 0.3.0 created files ending with a period sindresorhus/tempy#19

On windows, this causes jsvu to emit errors in the Testing section of installing runtimes. The runtimes are still installed, but the console has warning messages.
mathiasbynens pushed a commit to GoogleChromeLabs/jsvu that referenced this pull request May 24, 2020
Tempy 0.3.0 created files ending with a period sindresorhus/tempy#19

On windows, this causes jsvu to emit errors in the Testing section of installing runtimes. The runtimes are still installed, but the console has warning messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants