Skip to content

fix: disable configparser interpolation to support passwords with %#213

Open
chrisdebian wants to merge 3 commits into
mapilio:mainfrom
chrisdebian:fix/configparser-interpolation
Open

fix: disable configparser interpolation to support passwords with %#213
chrisdebian wants to merge 3 commits into
mapilio:mainfrom
chrisdebian:fix/configparser-interpolation

Conversation

@chrisdebian
Copy link
Copy Markdown
Contributor

Summary

configparser.ConfigParser() uses BasicInterpolation by default, which treats % in values as variable references (%m, %s, etc.). Any user whose password contains % gets an unrecoverable error at login time:

InterpolationSyntaxError: invalid interpolation syntax in '2*%m^NJ6yn&sKPRTemkP' at position 2

Fix

Pass interpolation=None to disable interpolation entirely:

config = configparser.ConfigParser(interpolation=None)

Credentials are now stored and retrieved literally regardless of content. This is the standard Python recommendation for config files that hold arbitrary user-supplied strings.

Test plan

  • Password containing %m, %s, %(foo)s no longer raises InterpolationSyntaxError
  • Normal passwords without % continue to work
  • All other config values (user name, email, token) unaffected

Fixes mapilio/MapSyncer#67

🤖 Generated with Claude Code

chrisdebian and others added 3 commits May 17, 2026 15:09
Hard-coded 4096x1344 values only work for one specific GoPro MAX
recording mode. Use exiftool computed-value syntax so CroppedArea
and FullPano tags are derived from actual ImageWidth/ImageHeight,
making the command work for any output resolution (e.g. 4096x2048).

CroppedAreaTopPixels = (ImageWidth/2 - ImageHeight) / 2

Closes mapilio#200
The upload loop was sending `bytes={offset}-{entity_size}/{entity_size}`
for every chunk. RFC 7233 requires the end value to be the last byte of
the *current chunk* (0-indexed, inclusive), not the total entity size.
For multi-chunk uploads this caused the server to reject intermediate
chunks with "Invalid Content-Range provided" (MapSyncer issue mapilio#87).

Fix: compute `chunk_end = offset + len(chunk) - 1` for non-empty chunks
and keep the existing sentinel value for the empty finalisation request.

Adds two unit tests covering single-chunk and multi-chunk Content-Range
header construction.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
configparser.ConfigParser() uses BasicInterpolation by default, which
treats % in values as variable references (e.g. %m, %s). A password
containing % raises:

    InterpolationSyntaxError: invalid interpolation syntax in '...'

Pass interpolation=None to disable this behaviour so credentials are
stored and retrieved literally regardless of content.

Fixes mapilio#67 (MapSyncer) — root cause is in this config reader.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

invalid interpolation syntax in '2*%m^NJ6yn&sKPRTemkP' at position 2. Please try again.

1 participant