Fix: task operations fail when name contains #, & or +#90
Open
underwear wants to merge 1 commit into
Open
Conversation
237ff10 to
4cef583
Compare
The OData $filter query in get_task_id_by_name breaks for task names with URL-special characters: - '#' is treated as a URL fragment identifier and truncates the query - '&' is treated as a query parameter separator - '+' is interpreted as a space This is a common issue because Microsoft To Do uses '#' for tags (e.g. "Buy groceries #shopping"). Fix: add _escape_odata_string() that double-percent-encodes these characters before embedding them in the OData filter URL. The HTTP layer decodes one level, and the OData parser decodes the second, producing the correct literal character. Reference: https://learn.microsoft.com/en-us/answers/questions/432875/how-do-you-escape-the-octothorpe-number-pound-hashtag-symbol-in-a-graph-api-odata-search-string Includes 17 unit tests for the escaping logic and filter URL construction.
4cef583 to
3a9a247
Compare
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.
Problem
complete,rmand other commands that look up a task by name fail when the task title contains#,&or+.This happens because
get_task_id_by_nameputs the task name directly into an OData$filterURL:#— interpreted as URL fragment, everything after it is cut off&— interpreted as query parameter separator, breaks the filter expression+— interpreted as a space, so the filter matches the wrong titleThis is a common issue because Microsoft To Do uses
#for tags.Solution
Add
_escape_odata_string()helper that double-percent-encodes these characters before embedding them in the URL. For example#becomes%2523. The HTTP layer decodes one level (%23), then the OData parser decodes the second level back to#.This approach is documented by Microsoft:
https://learn.microsoft.com/en-us/answers/questions/432875/how-do-you-escape-the-octothorpe-number-pound-hashtag-symbol-in-a-graph-api-odata-search-string
Changes
todocli/graphapi/wrapper.py— add_escape_odata_string(), use it inget_task_id_by_nametests/test_odata_escape.py— 17 unit tests for the escaping logic and filter URL constructiontests/run_tests.py— register new test moduleTest plan
rm,completewith task names containing#,&,+