Skip to content

Preserve literal percent characters in saved credentials - #216

Merged
ozcan-durak merged 2 commits into
mainfrom
codex/toolkit-config-literal-20261030
Nov 1, 2026
Merged

ozcan-durak merged 2 commits into
mainfrom
codex/toolkit-config-literal-20261030

Conversation

@ozcan-durak

Copy link
Copy Markdown
Contributor

Applies @chrisdebian's config-only fix from #213 without the upload and GoPro changes stacked underneath it. Passwords containing % were being interpreted by ConfigParser, which could raise an interpolation error or change a literal %%.

Added five credential-file roundtrip cases for plain text, %m, %s, %(missing)s and %%. Four failed before the fix; all five pass with it. Full suite: 105 passed.

The original commit is retained with its author and cherry-pick reference. A package release will still be needed before this reaches installed users.

chrisdebian and others added 2 commits October 30, 2026 19:20
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 #67 (MapSyncer) — root cause is in this config reader.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit 739bfd2)

@chrisdebian chrisdebian left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Ozcan, and thanks for keeping my authorship. I've reviewed this and approve it.

I checked that every reader and writer of the credentials file goes through load_config, so the one-line change covers them all. I ran the new tests locally: all five pass with the change, and four fail without it. The full suite passes (105 tests).

One side effect, and a good one: a saved password containing %% used to be read back as a single %. Now it comes back exactly as stored.

Once this is merged I'll close #213, as this replaces it.

Chris

@ozcan-durak ozcan-durak self-assigned this Nov 1, 2026
@ozcan-durak
ozcan-durak merged commit 7d4ede0 into main Nov 1, 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.

2 participants