Skip to content

fix: use regex in get_latest_version() to handle any quote style#210

Merged
ozcan-durak merged 1 commit into
mapilio:mainfrom
chrisdebian:fix/get-latest-version-index-error
May 18, 2026
Merged

fix: use regex in get_latest_version() to handle any quote style#210
ozcan-durak merged 1 commit into
mapilio:mainfrom
chrisdebian:fix/get-latest-version-index-error

Conversation

@chrisdebian

Copy link
Copy Markdown
Contributor

Summary

Fixes #209.

get_latest_version() in info.py was parsing the version string by splitting on a hard-coded quote character (split("'") in older releases, split('"') in current main). When the quote style in version.py does not match, split() returns a one-element list and [1] raises IndexError: list index out of range.

  • Replace the fragile split() approach with re.search() matching VERSION = "…" or VERSION = '…' — robust against any future quote-style change.
  • Add tests/test_info.py with regression tests covering both quote styles, HTTP 404, and a missing VERSION line.

Test plan

  • Existing 95 tests still pass (pytest tests/ -q)
  • 5 new regression tests added and passing (100 total)
  • Manually verified regex output against all three quote-style variants before applying

🤖 Generated with Claude Code

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>
@ozcan-durak ozcan-durak self-requested a review May 18, 2026 11:42
@ozcan-durak

Copy link
Copy Markdown
Contributor

clean fix, good that it comes with regression tests. approving the workflow and merging. thanks @chrisdebian

@ozcan-durak ozcan-durak merged commit 4a1be4f into mapilio:main May 18, 2026
4 checks passed
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.

fix: get_latest_version() raises IndexError when version.py format changes

2 participants