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

Spaces* in the key string supplied to Particle.variable() and .function() break cloud accesses and calls #64

Open
kh90909 opened this issue Apr 14, 2016 · 0 comments

Comments

@kh90909
Copy link
Contributor

kh90909 commented Apr 14, 2016

* and likely other characters that require URL encoding.

Particle.variable() and Particle.function() will accept a key string containing spaces, and these key strings are successfully conveyed to clients via the getDevice() API call. However, trying to use getVariable() or callFunction() fail because the key string forms part of the URL for the underlying GET / POST request.

URL encoding the key strings does not help. The Particle Cloud does not appear to decode them into the correct key strings internally.

I think it makes sense to add validation to Particle.variable() and Particle.function() to avoid this issue. We could either indicate failure by the return value, which is in line with the documentation for Particle.function(), or else just strip out the offending characters and replace them with something conspicuous. This might be more user friendly as it's somewhat involved on a board like the Oak to check the return value and communicate it via the LED or serial.

Particle.publishEvent() may also need similar validation, although I haven't yet found characters that cause problems.

To properly fix this, we need to know the list of characters allowed for variables, functions and events in the Particle Cloud. @digistump do you know what these chars are? If not, could you ask the Particle devs?

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

No branches or pull requests

1 participant