Skip to content

fix: normalizing file paths accidentally returning empty file path#453

Merged
charpeni merged 2 commits into
bundlewatch:masterfrom
cheapsteak:master
Jul 22, 2024
Merged

fix: normalizing file paths accidentally returning empty file path#453
charpeni merged 2 commits into
bundlewatch:masterfrom
cheapsteak:master

Conversation

@cheapsteak

@cheapsteak cheapsteak commented Mar 28, 2022

Copy link
Copy Markdown
Contributor

recommend reviewing with whitespace turned off

What kind of change does this PR introduce?

This fixes a bug for projects using a mix of content-hashing and stable filenames where files without a hash are replaced with an empty path

Did you add tests for your changes?

yes

Summary
follow up to #214 and #238

It's possible for a build to contain both filepaths with hashes and filepaths that are stable (without hashes)

If a pattern provided via normalizeFilenames doesn't match the path (e.g. filepath does not contain a hash), currently the normalized path becomes an empty string 😱 additionally, reports fail with a message of results.fullResults[0].filePath\" is not allowed to be empty

Does this PR introduce a breaking change?

no

@cheapsteak cheapsteak changed the title Bugfix: only attempt to remove pattern from path if pattern is found in path fix: only attempt to remove pattern from path if pattern is found in path Mar 28, 2022
@cheapsteak cheapsteak changed the title fix: only attempt to remove pattern from path if pattern is found in path fix: normalizing file paths accidentally returning empty file path Mar 28, 2022
@cheapsteak

Copy link
Copy Markdown
Contributor Author

@iamogbz mind taking a look? 🙏 🙏 (our bundlewatch links are broken until this if merged, hoping to avoid needing to patch-package)

@Beraliv

Beraliv commented Apr 18, 2022

Copy link
Copy Markdown

Thank you for your fix @cheapsteak!

I can also reproduce it here – Beraliv/beraliv.dev#440, would be glad to have it merged if it fixes the problem

@Beraliv

Beraliv commented Jun 21, 2022

Copy link
Copy Markdown

@iamogbz @charpeni hey!

Sorry for pinging you, but I wanted to check if this PR can be merged to make normalizefilenames option working?

Currently I see this in my blog repo CI

{"message":"\"results.fullResults[0].filePath\" is not allowed to be empty","path":["results","fullResults",0,"filePath"],"type":"string.empty","context":{"label":"results.fullResults[0].filePath","value":"","key":"filePath"}}

@cheapsteak

Copy link
Copy Markdown
Contributor Author

yup that looks like the same error I was getting

this PR should fix that

@marcagba

marcagba commented Jul 5, 2022

Copy link
Copy Markdown

Hi @charpeni !
Sorry to ping you!
Do you think you could merge this PR ? 🙏

@cheapsteak

Copy link
Copy Markdown
Contributor Author

@jakebolam any chance you might have time to take a gander? 🙏

@Beraliv

Beraliv commented Aug 16, 2022

Copy link
Copy Markdown

Any updates on this one?

@Beraliv

Beraliv commented Sep 15, 2022

Copy link
Copy Markdown

@charpeni @jakebolam Could you please have a look at it?

@cheapsteak

cheapsteak commented Feb 10, 2023

Copy link
Copy Markdown
Contributor Author

For anyone else running into this, you can fix this locally yourself with patch-package and applying the changes in this PR yourself as a patch

you should end up with a patch file that looks something like this
bundlewatch+0.3.2.patch

@Beraliv

Beraliv commented Feb 11, 2023

Copy link
Copy Markdown

For anyone else running into this, you can fix this locally yourself with patch-package and applying the changes in this PR yourself as a patch

you should end up with a patch file that looks something like this bundlewatch+0.3.2.patch

Good suggestion, thank you for sharing it! 🧡 I totally forgot about this option!

@charpeni charpeni left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@charpeni charpeni merged commit 048e9b4 into bundlewatch:master Jul 22, 2024
@coveralls

Copy link
Copy Markdown

Pull Request Test Coverage Report for Build bb5bf160-a3f4-4baf-bdce-d591f7ef67d1

Details

  • 2 of 2 (100.0%) changed or added relevant lines in 1 file are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.1%) to 81.762%

Files with Coverage Reduction New Missed Lines %
src/app/reporting/GitHubService/index.js 4 75.47%
src/app/reporting/BundleWatchService/index.js 7 75.93%
Totals Coverage Status
Change from base Build b2bbd0e6-f4c3-4192-89e3-b5741dfbef99: -0.1%
Covered Lines: 272
Relevant Lines: 318

💛 - Coveralls

kkrishguptaa referenced this pull request in kkrishguptaa/reseter.css Aug 2, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[@semantic-release/github](https://togithub.com/semantic-release/github)
| [`10.1.0` ->
`10.1.3`](https://renovatebot.com/diffs/npm/@semantic-release%2fgithub/10.1.0/10.1.3)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/@semantic-release%2fgithub/10.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@semantic-release%2fgithub/10.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@semantic-release%2fgithub/10.1.0/10.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@semantic-release%2fgithub/10.1.0/10.1.3?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [bundlewatch](https://togithub.com/bundlewatch/bundlewatch) | [`0.3.3`
-> `0.4.0`](https://renovatebot.com/diffs/npm/bundlewatch/0.3.3/0.4.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/bundlewatch/0.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/bundlewatch/0.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/bundlewatch/0.3.3/0.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/bundlewatch/0.3.3/0.4.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
| [postcss](https://postcss.org/)
([source](https://togithub.com/postcss/postcss)) | [`8.4.39` ->
`8.4.40`](https://renovatebot.com/diffs/npm/postcss/8.4.39/8.4.40) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/postcss/8.4.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/postcss/8.4.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/postcss/8.4.39/8.4.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/postcss/8.4.39/8.4.40?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>semantic-release/github
(@&#8203;semantic-release/github)</summary>

###
[`v10.1.3`](https://togithub.com/semantic-release/github/releases/tag/v10.1.3)

[Compare
Source](https://togithub.com/semantic-release/github/compare/v10.1.2...v10.1.3)

##### Bug Fixes

- Revert "fix: failing release due to renamed repository
([#&#8203;878](https://togithub.com/semantic-release/github/issues/878))"
([#&#8203;887](https://togithub.com/semantic-release/github/issues/887))
([325952e](https://togithub.com/semantic-release/github/commit/325952e3a9fab8e728ba250890587f6af85cfa9e))

###
[`v10.1.2`](https://togithub.com/semantic-release/github/releases/tag/v10.1.2)

[Compare
Source](https://togithub.com/semantic-release/github/compare/v10.1.1...v10.1.2)

##### Bug Fixes

- failing release due to renamed repository
([#&#8203;878](https://togithub.com/semantic-release/github/issues/878))
([76fdaa3](https://togithub.com/semantic-release/github/commit/76fdaa31cd623a3df1c4e51ae1ed4434a24a2c3e))

###
[`v10.1.1`](https://togithub.com/semantic-release/github/releases/tag/v10.1.1)

[Compare
Source](https://togithub.com/semantic-release/github/compare/v10.1.0...v10.1.1)

##### Bug Fixes

- invalid GraphQL query generated when no release commits are found
([#&#8203;876](https://togithub.com/semantic-release/github/issues/876))
([8ee2744](https://togithub.com/semantic-release/github/commit/8ee2744905e73137b3e24b2f56b37ff4451c32f7))

</details>

<details>
<summary>bundlewatch/bundlewatch (bundlewatch)</summary>

###
[`v0.4.0`](https://togithub.com/bundlewatch/bundlewatch/releases/tag/v0.4.0)

[Compare
Source](https://togithub.com/bundlewatch/bundlewatch/compare/v0.3.3...v0.4.0)

#### What's Changed

> \[!WARNING]
> The minimum Node version supported is now **16**, but it may work fine
with older versions.

##### Features

- feat: support mjs and cjs extensions by
[@&#8203;EdieLemoine](https://togithub.com/EdieLemoine) in
[https://github.com/bundlewatch/bundlewatch/pull/460](https://togithub.com/bundlewatch/bundlewatch/pull/460)

##### Bug Fixes and Chores

- chore: fix linter by [@&#8203;charpeni](https://togithub.com/charpeni)
in
[https://github.com/bundlewatch/bundlewatch/pull/467](https://togithub.com/bundlewatch/bundlewatch/pull/467)
- chore: bump node to `20.15.1` (LTS) by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/bundlewatch/bundlewatch/pull/468](https://togithub.com/bundlewatch/bundlewatch/pull/468)
- fix: normalizing file paths accidentally returning empty file path by
[@&#8203;cheapsteak](https://togithub.com/cheapsteak) in
[https://github.com/bundlewatch/bundlewatch/pull/453](https://togithub.com/bundlewatch/bundlewatch/pull/453)
- chore: bump `babel` by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/bundlewatch/bundlewatch/pull/469](https://togithub.com/bundlewatch/bundlewatch/pull/469)
- `s/messsage/message` by
[@&#8203;charpeni](https://togithub.com/charpeni) in
[https://github.com/bundlewatch/bundlewatch/pull/48](https://togithub.com/bundlewatch/bundlewatch/pull/48)

##### CVEs

- build(deps): bump minimist from 1.2.5 to 1.2.8 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/461](https://togithub.com/bundlewatch/bundlewatch/pull/461)
- build(deps): bump json5 from 1.0.1 to 1.0.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/459](https://togithub.com/bundlewatch/bundlewatch/pull/459)
- build(deps): bump qs from 6.5.2 to 6.5.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/458](https://togithub.com/bundlewatch/bundlewatch/pull/458)
- build(deps): bump axios from 0.24.0 to 0.28.0 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/472](https://togithub.com/bundlewatch/bundlewatch/pull/472)
- build(deps): bump braces from 3.0.2 to 3.0.3 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/471](https://togithub.com/bundlewatch/bundlewatch/pull/471)
- build(deps): bump semver from 5.7.1 to 5.7.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/473](https://togithub.com/bundlewatch/bundlewatch/pull/473)
- build(deps): bump word-wrap from 1.2.3 to 1.2.5 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/474](https://togithub.com/bundlewatch/bundlewatch/pull/474)
- build(deps): bump ws from 7.5.6 to 7.5.10 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/475](https://togithub.com/bundlewatch/bundlewatch/pull/475)
- build(deps): bump
[@&#8203;babel/traverse](https://togithub.com/babel/traverse) from
7.16.8 to 7.24.8 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/476](https://togithub.com/bundlewatch/bundlewatch/pull/476)
- build(deps): bump minimatch from 3.0.4 to 3.1.2 by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/477](https://togithub.com/bundlewatch/bundlewatch/pull/477)
- build(deps): bump hosted-git-info from 2.7.1 to 2.8.9 in the
npm_and_yarn group by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[https://github.com/bundlewatch/bundlewatch/pull/478](https://togithub.com/bundlewatch/bundlewatch/pull/478)

#### New Contributors

- [@&#8203;EdieLemoine](https://togithub.com/EdieLemoine) made their
first contribution in
[https://github.com/bundlewatch/bundlewatch/pull/460](https://togithub.com/bundlewatch/bundlewatch/pull/460)
🎉

**Full Changelog**:
bundlewatch/bundlewatch@v0.3.3...v0.4.0

</details>

<details>
<summary>postcss/postcss (postcss)</summary>

###
[`v8.4.40`](https://togithub.com/postcss/postcss/blob/HEAD/CHANGELOG.md#8440)

[Compare
Source](https://togithub.com/postcss/postcss/compare/8.4.39...8.4.40)

- Moved to getter/setter in nodes types to help Sass team (by
[@&#8203;nex3](https://togithub.com/nex3)).

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job
log](https://developer.mend.io/github/kkrishguptaa/reseter.css).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
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.

5 participants