Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encode URL syntax characters in form IDs #53

Closed
matthew-white opened this issue May 8, 2023 · 2 comments · Fixed by #55
Closed

Encode URL syntax characters in form IDs #53

matthew-white opened this issue May 8, 2023 · 2 comments · Fixed by #55

Comments

@matthew-white
Copy link
Member

Software and hardware versions

pyodk v0.3.0, Python v3.11.3

Problem description

When using a form ID in a URL, pyODK doesn't encode all the characters I'd expect it to. For example, when I run the following:

client.forms.update(project_id=1, form_id='x/y', definition='my_form.xml')

I see that a request is sent to /v1/projects/1/forms/x/y/draft, not /v1/projects/1/forms/x%2Fy/draft.

It seems to me like pyODK encodes many characters, but doesn't encode the following URL syntax characters: ; / ? : @ & = + $ , #

I didn't look at how pyODK uses submission instance IDs in URLs, but those also need to be encoded.

@lindsay-stevens
Copy link
Contributor

@matthew-white thanks for the report - are these URL syntax characters allowed and supported identifiers in Central, Collect, and Enketo? It sounds like they are but will be helpful to know what to expect when testing.

@matthew-white
Copy link
Member Author

Yes, the ODK XForms spec allows form IDs and submission instance IDs to be arbitrary strings. In practice, form IDs vary a lot, while instance IDs sent from Collect and Enketo follow a specific pattern.

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 a pull request may close this issue.

2 participants