Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

fix(Issue-996): replace whitespaces in namespaces string with commas globally #997

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

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

pdahal-cx
Copy link
Contributor

This change uses a regex to replace whitespaces in namespaces string with commas globally instead of just the first space occurrence. This fixes the issue reported below.

Issue: #996
In the following code in src/common.js, the namespaces string with multiple space delimiters is incorrectly only split at the occurrence of first space due to the replace() function only replacing the first occurrence of space with a comma. This leads to a names array of only two string elements with the second element possibly being incorrect. The replace() function should replace spaces with commas globally.

const split = (typeof namespaces === 'string' ? namespaces : '')
			.trim()
			.replace(' ', ',')
			.split(',')
			.filter(Boolean);

		for (const ns of split) {
			if (ns[0] === '-') {
				createDebug.skips.push(ns.slice(1));
			} else {
				createDebug.names.push(ns);
			}
		}

@Qix- Qix- merged commit a0497bd into debug-js:master Mar 21, 2025
@Qix-
Copy link
Member

Qix- commented Mar 21, 2025

Thanks! I can't do a release today but if I miss it over the next week just ping me again and I'll push one out. Appreciate the quick turnaround :)

@gregmartyn
Copy link

@Qix- ping in case you forgot about doing the release

@Qix-
Copy link
Member

Qix- commented May 13, 2025

@gregmartyn Thanks! Published as 4.4.1.

Blankll added a commit to geek-fun/dockit that referenced this pull request Jun 14, 2025
![snyk-top-banner](https://res.cloudinary.com/snyk/image/upload/r-d/scm-platform/snyk-pull-requests/pr-banner-default.svg)


<h3>Snyk has created this PR to upgrade debug from 4.4.0 to 4.4.1.</h3>

:information_source: Keep your dependencies up-to-date. This makes it
easier to fix existing vulnerabilities and to more quickly identify and
fix newly disclosed vulnerabilities when they affect your project.

<hr/>


- The recommended version is **1 version** ahead of your current
version.

- The recommended version was released **a month ago**.



<details>
<summary><b>Release notes</b></summary>
<br/>
  <details>
    <summary>Package name: <b>debug</b></summary>
    <ul>
      <li>
<b>4.4.1</b> - <a
href="https://redirect.github.com/debug-js/debug/releases/tag/4.4.1">2025-05-13</a></br><h2>What's
Changed</h2>
<ul>
<li>fix(Issue-996): replace whitespaces in namespaces string with commas
globally by <a class="user-mention notranslate"
data-hovercard-type="user"
data-hovercard-url="/users/pdahal-cx/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/pdahal-cx">@ pdahal-cx</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2938748601" data-permission-text="Title is private"
data-url="debug-js/debug#997"
data-hovercard-type="pull_request"
data-hovercard-url="/debug-js/debug/pull/997/hovercard"
href="https://redirect.github.com/debug-js/debug/pull/997">#997</a></li>
<li>fixes <a class="issue-link js-issue-link" data-error-text="Failed to
load title" data-id="2788605483" data-permission-text="Title is private"
data-url="debug-js/debug#987"
data-hovercard-type="issue"
data-hovercard-url="/debug-js/debug/issues/987/hovercard"
href="https://redirect.github.com/debug-js/debug/issues/987">#987</a>
fallback to localStorage.DEBUG if debug is not defined by <a
class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/lzilioli/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/lzilioli">@ lzilioli</a> in <a
class="issue-link js-issue-link" data-error-text="Failed to load title"
data-id="2788615273" data-permission-text="Title is private"
data-url="debug-js/debug#988"
data-hovercard-type="pull_request"
data-hovercard-url="/debug-js/debug/pull/988/hovercard"
href="https://redirect.github.com/debug-js/debug/pull/988">#988</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/pdahal-cx/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/pdahal-cx">@ pdahal-cx</a> made their
first contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2938748601"
data-permission-text="Title is private"
data-url="debug-js/debug#997"
data-hovercard-type="pull_request"
data-hovercard-url="/debug-js/debug/pull/997/hovercard"
href="https://redirect.github.com/debug-js/debug/pull/997">#997</a></li>
<li><a class="user-mention notranslate" data-hovercard-type="user"
data-hovercard-url="/users/lzilioli/hovercard"
data-octo-click="hovercard-link-click"
data-octo-dimensions="link_type:self"
href="https://redirect.github.com/lzilioli">@ lzilioli</a> made their
first contribution in <a class="issue-link js-issue-link"
data-error-text="Failed to load title" data-id="2788615273"
data-permission-text="Title is private"
data-url="debug-js/debug#988"
data-hovercard-type="pull_request"
data-hovercard-url="/debug-js/debug/pull/988/hovercard"
href="https://redirect.github.com/debug-js/debug/pull/988">#988</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://redirect.github.com/debug-js/debug/compare/4.4.0...4.4.1"><tt>4.4.0...4.4.1</tt></a></p>
      </li>
      <li>
<b>4.4.0</b> - <a
href="https://redirect.github.com/debug-js/debug/releases/tag/4.4.0">2024-12-06</a></br><p>Fixes
(hopefully) the inefficient regex warnings in
<code>.enable()</code>.</p>
<p>Minor version as this is invariably going to break certain users who
misuse the <code>.enable()</code> API and expected it to work with
regexes, which was never supported nor documented. That's on you, sorry
- that functionality won't be added back.</p>
<p><strong>Full Changelog</strong>: <a class="commit-link"
href="https://redirect.github.com/debug-js/debug/compare/4.3.7...4.4.0"><tt>4.3.7...4.4.0</tt></a></p>
      </li>
    </ul>
from <a href="https://redirect.github.com/debug-js/debug/releases">debug
GitHub release notes</a>
  </details>
</details>

---

> [!IMPORTANT]
>
> - Check the changes in this PR to ensure they won't cause issues with
your project.
> - This PR was automatically created by Snyk using the credentials of a
real user.

---

**Note:** _You are seeing this because you or someone else with access
to this repository has authorized Snyk to open upgrade PRs._

**For more information:** <img
src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJmZjJiOTA5NS1lM2U0LTQ2MjUtYmY5ZC1kYzAzMzkwMzdiYzciLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImZmMmI5MDk1LWUzZTQtNDYyNS1iZjlkLWRjMDMzOTAzN2JjNyJ9fQ=="
width="0" height="0"/>

> - 🧐 [View latest project
report](https://app.snyk.io/org/blankll/project/d19c39b4-9b25-4232-b09a-2d71e94c8a24?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 📜 [Customise PR
templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template)
> - 🛠 [Adjust upgrade PR
settings](https://app.snyk.io/org/blankll/project/d19c39b4-9b25-4232-b09a-2d71e94c8a24/settings/integration?utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr)
> - 🔕 [Ignore this dependency or unsubscribe from future upgrade
PRs](https://app.snyk.io/org/blankll/project/d19c39b4-9b25-4232-b09a-2d71e94c8a24/settings/integration?pkg&#x3D;debug&amp;utm_source&#x3D;github&amp;utm_medium&#x3D;referral&amp;page&#x3D;upgrade-pr#auto-dep-upgrades)

[//]: #
'snyk:metadata:{"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"debug","from":"4.4.0","to":"4.4.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"ff2b9095-e3e4-4625-bf9d-dc0339037bc7","prPublicId":"ff2b9095-e3e4-4625-bf9d-dc0339037bc7","packageManager":"npm","priorityScoreList":[],"projectPublicId":"d19c39b4-9b25-4232-b09a-2d71e94c8a24","projectUrl":"https://app.snyk.io/org/blankll/project/d19c39b4-9b25-4232-b09a-2d71e94c8a24?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-05-13T20:56:36.431Z"},"vulns":[]}'

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.