Have you checked that the bug is not already fixed?
Yes
Summary
The input parameter --projectBaseUrl is ignored when running with commander 14.0.3.
Affected version
3.14.2
Steps to reproduce the bug
Create a configuration file (config.json) that includes the base URL, such as:
{
"replacementPatterns": [
{
"pattern": "^/",
"replacement": "{{BASEURL}}/"
}
]
}
Then call markdown-link-check with the config file and with the projectBaseUrl parameter set:
markdown-link-check --projectBaseUrl=file:///path/to/project --config=config.json test.md
Expected behavior
Each link the markdown file beginning with / should be prepended with the path provided in projectBaseUrl.
Actual behavior
The projectBaseUrl is completely ignored, and instead the current working directory is used.
Additional context
I believe the issue stems from this line of code:
|
if (program.projectBaseUrl) { |
Instead of
program.projectBaseUrl,
program.opts().projectBaseUrl should be used, as is done for all other options.
A breaking change was introduced in Commander 7.0.0 which required retrieving options via
opts() -
https://github.com/tj/commander.js/blob/master/CHANGELOG.md#700-2021-01-15
Can you fix it?
Yes
Have you checked that the bug is not already fixed?
Yes
Summary
The input parameter
--projectBaseUrlis ignored when running with commander 14.0.3.Affected version
3.14.2
Steps to reproduce the bug
Create a configuration file (
config.json) that includes the base URL, such as:Then call
markdown-link-checkwith the config file and with theprojectBaseUrlparameter set:Expected behavior
Each link the markdown file beginning with
/should be prepended with the path provided inprojectBaseUrl.Actual behavior
The
projectBaseUrlis completely ignored, and instead the current working directory is used.Additional context
I believe the issue stems from this line of code:
markdown-link-check/markdown-link-check
Line 370 in 26bf9f6
Instead of
program.projectBaseUrl,program.opts().projectBaseUrlshould be used, as is done for all other options.A breaking change was introduced in Commander 7.0.0 which required retrieving options via
opts()- https://github.com/tj/commander.js/blob/master/CHANGELOG.md#700-2021-01-15Can you fix it?
Yes