Description
Bug Report
Description
In remote_hvcs_base.py, the following functions have an improper usage of lstrip:
- create_server_url
- create_api_url
- create_repo_url
They are all accompanied by the comment:
"Ensure any path prefix is transfered but not doubled up on the derived url"
The code: path=f"{self.hvcs_domain.path or ''}/{path.lstrip(self.hvcs_domain.path)}",
Does not work as desired. lstrip does not look for the entire input as a whole, rather it processes it character by character. This causes issues if the domain from the configuration file has additional path parameters, and the repo "owner" have over lapping characters. This leads to improper URLs being given for links in the changelog.
For example:
domain = "https://bitbucket.company.com/projects/demo-foo"
owner (taken from git) = foo
repo (taken from git) = baz
Expected behavior
The URL for the commit in the changelog is:
https://bitbucket.company.com/projects/demo-foo/foo/baz/commit/
Actual behavior
The URL for the commit in the changelog is:
https://bitbucket.company.com/projects/demo-foo/baz/commit/
The /foo is now missing because it is being removed by the lstrip, since the characters o/f all existing at the start of the commit string.
Environment
- Operating System (w/ version): Red Hat Enterprise Linux 8.10
- Python version: 3.11
- Pip version: 23.1
- Semantic-release version: 9.21.0
-
- Build tool (w/ version): poetry 1.2.2
pip freeze
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
click-option-group==0.5.6
coverage==7.6.12
darglint==1.8.1
Deprecated==1.2.18
docutils==0.21.2
dotty-dict==1.3.1
flake8==6.1.0
flake8-docstrings==1.7.0
Flake8-pyproject==1.2.3
gitdb==4.0.12
GitPython==3.1.44
idna==3.10
importlib_resources==6.5.2
isort==6.0.1
Jinja2==3.1.5
lxml==5.3.1
m2r2==0.3.3.post2
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mccabe==0.7.0
mdurl==0.1.2
mistune==0.8.4
mypy==1.15.0
mypy-extensions==1.0.0
parameterized==0.9.0
pep8-naming==0.14.1
pycodestyle==2.11.1
pydantic==2.0.3
pydantic_core==2.3.0
pydocstyle==6.3.0
pyflakes==3.1.0
Pygments==2.19.1
python-gitlab==4.13.0
python-semantic-release==9.21.0
regex==2024.11.6
requests==2.32.3
requests-toolbelt==1.0.0
rich==13.9.4
shellingham==1.5.4
smmap==5.0.2
snowballstemmer==2.2.0
Sphinx==8.2.3
sphinx-argparse==0.5.2
sphinxcontrib-confluencebuilder==2.11.0
toml==0.10.2
toml-cli==0.7.0
tomlkit==0.13.2
typer==0.15.2
types-toml==0.10.8.20240310
typing_extensions==4.12.2
unittest-xml-reporting==3.2.0
urllib3==2.3.0
wrapt==1.17.2
git log --oneline --decorate --graph --all -n 50
N/A
Configuration
Semantic Release Configuration
Build System Configuration
[tool.semantic_release.remote]
type = "bitbucket"
domain = 'https://bitbucket.company.com/bddc/projects'
GitHub Actions Job Definition
N/A
Execution Log
N/A
semantic-release -vv command
N/A