Repository navigation
fix(runtime): escape single quotes once in OData string literals - #1053
Merged
vgrem merged 1 commit intoOct 5, 2026
Merged
Conversation
ODataPathBuilder._encode_string doubled each single quote explicitly and then again through the _SPECIAL_CHARS table, so "d'appello" was encoded as 'd''''appello' instead of 'd''appello'. Paths and names containing an apostrophe therefore resolved to the wrong resource. Drop the explicit replace and let the table handle the quote, and add unit tests for quote and special-character escaping. Fixes vgrem#1052
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 #1052.
ODataPathBuilder._encode_stringescaped a single quote twice: once with an explicitvalue.replace("'", "''")and again through the_SPECIAL_CHARStable, which also maps'to''. As a resultd'appellowas encoded as'd''''appello'instead of'd''appello', so any SharePoint path or name containing an apostrophe pointed at the wrong resource, for example:The change removes the explicit replace and leaves the quote to the table. The reporter saw it on Windows only, but the code path is not platform specific; I reproduced it on current
master.Type of change
Checklist
uv run ruff check .passes.ruff format --checkpasses for the two changed Python files; I did not rely on the repo-wide run because my Windows checkout has CRLF working copies, which makes it report every file.uv run pyrightis clean (0 errors)uv run pytest --offline -qpasses (823 passed, 986 skipped; 820 passed before the new tests)uv run mkdocs build --strictpasses (no docs or examples changed, not run)tests/unitwhere practicalTests
Three tests added to
tests/unit/test_runtime_paths.py. The two quote tests fail onmasterand pass with the fix; the third pins the existing behaviour that%,+,&,#,?and*are each encoded once, so the replacement text is not re-encoded.