Repository navigation
[Bug] createWildcardRegex invalid regular expression #405 and link checker #401 - #402
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
Files not reviewed (1)
- package.json: Language not supported
Comments suppressed due to low confidence (1)
lib/test/readme-links-check.js:1
- [nitpick] Consider removing or updating the hard-coded file path in the file header comment to avoid confusion when used in different environments.
// filepath: d:\gith1\tsUtils\lib\test\readme-links-check.js
| // Configuration | ||
| const readmePath = path.resolve(__dirname, '../../README.md'); | ||
| const docsBasePath = path.resolve(__dirname, '../../docs'); | ||
| const baseUrl = 'https://nevware21.github.io/ts-utils/typedoc/'; |
Check failure
Code scanning / CodeQL
Incomplete regular expression for hostnames
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
This autofix suggestion was applied.
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI over 1 year ago
To fix the problem, we need to ensure that the . characters in the baseUrl string are properly escaped when constructing the regular expression. This will prevent the regular expression from matching unintended hosts.
- Update the
baseUrlstring to escape the.characters. - Modify the regular expression construction to use the updated
baseUrl.
Suggested changeset
1
lib/test/readme-links-check.js
| @@ -7,3 +7,3 @@ | ||
| const docsBasePath = path.resolve(__dirname, '../../docs'); | ||
| const baseUrl = 'https://nevware21.github.io/ts-utils/typedoc/'; | ||
| const baseUrl = 'https://nevware21\\.github\\.io/ts-utils/typedoc/'; | ||
|
|
||
| @@ -23,3 +23,3 @@ | ||
| // Extract all links that start with the baseUrl | ||
| const linkRegex = new RegExp(`(${baseUrl.replace(/\//g, '\\/').replace(/\./g, '\\.')}[^\\)"'\\s]+)`, 'g'); | ||
| const linkRegex = new RegExp(`(${baseUrl.replace(/\//g, '\\/')}[^\\)"'\\s]+)`, 'g'); | ||
| let match; |
Copilot is powered by AI and may make mistakes. Always verify output.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #402 +/- ##
=======================================
Coverage 97.72% 97.72%
=======================================
Files 115 115
Lines 2946 2946
Branches 603 604 +1
=======================================
Hits 2879 2879
Misses 67 67
🚀 New features to boost your workflow:
|
nev21
force-pushed
the
nev21/PrepareRelease
branch
from
April 16, 2025 05:31
c7b1857 to
ffd1063
Compare
[Task] Add pre-release testing validation with external projects #401 - Add simple readme link checker
nev21
force-pushed
the
nev21/PrepareRelease
branch
from
April 16, 2025 06:01
ffd1063 to
270c2c4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Bug] createWildcardRegex has an invalid regular expression #405
[Task] Add pre-release testing validation with external projects #401