fix: use regex in get_latest_version() to handle any quote style#210
Merged
ozcan-durak merged 1 commit intoMay 18, 2026
Merged
Conversation
Replaces the fragile split('"')[1] approach with a re.search() that
matches VERSION lines using either single or double quotes. Fixes the
IndexError reported in issue mapilio#209 when version.py quote style differs
from the hard-coded delimiter in older installed versions.
Adds tests/test_info.py with regression tests covering both quote
styles, HTTP failure, and missing VERSION line.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
|
clean fix, good that it comes with regression tests. approving the workflow and merging. thanks @chrisdebian |
3 tasks
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.
Summary
Fixes #209.
get_latest_version()ininfo.pywas parsing the version string by splitting on a hard-coded quote character (split("'")in older releases,split('"')in currentmain). When the quote style inversion.pydoes not match,split()returns a one-element list and[1]raisesIndexError: list index out of range.split()approach withre.search()matchingVERSION = "…"orVERSION = '…'— robust against any future quote-style change.tests/test_info.pywith regression tests covering both quote styles, HTTP 404, and a missingVERSIONline.Test plan
pytest tests/ -q)🤖 Generated with Claude Code