Fix lazy "latest" GitRelease returning tag_name "latest" by Noethix55555 · Pull Request #3524 · PyGithub/PyGithub · GitHub
Skip to content

Fix lazy "latest" GitRelease returning tag_name "latest"#3524

Open
Noethix55555 wants to merge 1 commit into
PyGithub:mainfrom
Noethix55555:fix/gitrelease-latest-tagname
Open

Fix lazy "latest" GitRelease returning tag_name "latest"#3524
Noethix55555 wants to merge 1 commit into
PyGithub:mainfrom
Noethix55555:fix/gitrelease-latest-tagname

Conversation

@Noethix55555

Copy link
Copy Markdown
Contributor

Fixes #3486.

A GitRelease fetched via get_latest_release() has a URL ending in .../releases/latest. When tag_name was absent, GitRelease._useAttributes derived tag_name from the last URL path segment ("latest") and marked _tag_name as set, which short-circuits lazy completion and returns the literal string "latest" instead of the real tag.

This skips the URL fallback when the last segment is "latest", leaving _tag_name unset so lazy completion fetches the real tag_name.

Regression test added in tests/GitRelease.py::testLazyLatestReleaseDoesNotDeriveTagNameFromUrl (fails on main, passes with the fix).

A GitRelease fetched via get_latest_release() has a URL ending in
.../releases/latest. When tag_name was absent, _useAttributes derived
tag_name from the last URL path segment ("latest") and marked
_tag_name as set, short-circuiting lazy completion and returning the
literal string "latest" instead of the real tag.

Skip the URL fallback when the last segment is "latest", leaving
_tag_name unset so lazy completion fetches the real tag_name.
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.

Lazy "latest" GitRelease has wrong tag_name

1 participant