Skip to content

Unexpected & Invalid urls generated in changelog #1204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
krisrave opened this issue Mar 4, 2025 · 3 comments · Fixed by #1239
Closed

Unexpected & Invalid urls generated in changelog #1204

krisrave opened this issue Mar 4, 2025 · 3 comments · Fixed by #1239
Labels
bug Something isn't working properly

Comments

@krisrave
Copy link

krisrave commented Mar 4, 2025

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

Additional context

@krisrave krisrave added bug Something isn't working properly triage waiting for initial maintainer review labels Mar 4, 2025
@codejedi365
Copy link
Contributor

Thanks. Will take a look.

@codejedi365 codejedi365 added confirmed Prevent from becoming stale and removed triage waiting for initial maintainer review labels Mar 4, 2025
@codejedi365 codejedi365 changed the title lstrip not a valid method to remove substring from start of a different string. Unexpected & Invalid urls generated in changelog Mar 4, 2025
Copy link

github-actions bot commented May 4, 2025

It has been 60 days since the last update on this confirmed issue. @python-semantic-release/team can you provide an update on the status of this issue?

@github-actions github-actions bot added the needs-update Needs status update from maintainers label May 4, 2025
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
codejedi365 added a commit to codejedi365/python-semantic-release that referenced this issue May 5, 2025
…are common letters

The change adjusts the url normalization computation to remove any
path prefix and only the path prefix even when letters are shared with
the rest of the url path.

Resolves: python-semantic-release#1204
@codejedi365
Copy link
Contributor

🎉 This issue has been resolved in Version 9.21.1 🎉

You can find more information about this release on the GitHub Releases page.

@codejedi365 codejedi365 removed confirmed Prevent from becoming stale needs-update Needs status update from maintainers labels May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working properly
Projects
None yet
2 participants