Skip to content

fix: update getFilenameFromUrl to return errorCode and filename#2253

Merged
alexander-akait merged 6 commits intonextfrom
bsebas/todoAboutFilename
Jan 27, 2026
Merged

fix: update getFilenameFromUrl to return errorCode and filename#2253
alexander-akait merged 6 commits intonextfrom
bsebas/todoAboutFilename

Conversation

@bjohansebas
Copy link
Member

Summary

I’m removing this TODO that was there. I still need to investigate whether the next TODO actually exists and fix it if so. Now that it returns other things, I think we should change the name, what do you think?

What kind of change does this PR introduce?

Did you add tests for your changes?

Does this PR introduce a breaking change?

If relevant, what needs to be documented once your changes are merged or what have you already documented?

@codecov
Copy link

codecov bot commented Jan 25, 2026

Codecov Report

❌ Patch coverage is 94.28571% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.67%. Comparing base (063213e) to head (6029167).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
src/middleware.js 93.75% 1 Missing ⚠️
src/utils/getFilenameFromUrl.js 94.44% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2253      +/-   ##
==========================================
- Coverage   95.85%   95.67%   -0.19%     
==========================================
  Files          13       13              
  Lines         892      901       +9     
  Branches      260      263       +3     
==========================================
+ Hits          855      862       +7     
- Misses         37       39       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@bjohansebas
Copy link
Member Author

Moving back to draft because we need to use new URL() and stop using url.parse()

@bjohansebas bjohansebas marked this pull request as draft January 26, 2026 22:49
@bjohansebas bjohansebas force-pushed the bsebas/todoAboutFilename branch 2 times, most recently from 85bcecc to f56758e Compare January 27, 2026 04:29
@bjohansebas
Copy link
Member Author

Okay, for now one test is failing. When publicPath is defined, the behavior of using new URL is more different than I expected. We need to make sure it doesn’t imply additional changes, because new URL is not a direct replacement for url.parse.

@alexander-akait alexander-akait force-pushed the bsebas/todoAboutFilename branch from f56758e to d3d6299 Compare January 27, 2026 12:47
@alexander-akait
Copy link
Member

Refactored to use throw when we have real problems and return undefined when not found (or not parsable)

@alexander-akait
Copy link
Member

Also I am thinking about union parse url and publicPath, less calls and faster, but we need extra checks here, all possible values - https://webpack.js.org/configuration/output/#outputpublicpath + broken cases

@alexander-akait alexander-akait marked this pull request as ready for review January 27, 2026 19:23
@alexander-akait alexander-akait merged commit 35dd70b into next Jan 27, 2026
12 of 14 checks passed
@alexander-akait alexander-akait deleted the bsebas/todoAboutFilename branch January 27, 2026 19:26
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