Skip to content

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

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

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>
@ozcan-durak

Copy link
Copy Markdown
Contributor

Thanks, Chris. The config change works: I reproduced four percent-character failures before it and all five credential-file cases pass with it. I isolated your commit, kept your authorship, and added those tests in #216 so it can proceed without #212 or the GoPro change. The full suite passes on Python 3.9–3.12. Could you review that clean version? It still needs the repository’s required second-person approval.

@ozcan-durak

Copy link
Copy Markdown
Contributor

Thanks, Chris — your config fix is merged through #216 now, with the percent-character regressions and all 105 tests passing. Closing this superseded version so we keep the upload and GoPro changes separate. A package release is still needed for installed users.

@ozcan-durak ozcan-durak closed this Nov 3, 2026
@chrisdebian
chrisdebian deleted the fix/configparser-interpolation branch November 10, 2026 07:59
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.

Login fails when the password contains a percent character

2 participants