Warning: Deprecated! Heroku Eclipse plugin is a fully integrated plugin into Eclipse IDE that will allow developers to manage their Heroku apps and environment right from their favourite IDE
15
stars
8
forks
source link
HerokuAPI dies with umlauts in environment variable names #54
Exception in thread "Thread-10" com.heroku.api.exception.RequestFailedException: Config add failed statuscode:400 responseBody:{"error":"Invalid request body"}
at com.heroku.api.request.config.ConfigAdd.getResponse(ConfigAdd.java:61)
at com.heroku.api.request.config.ConfigAdd.getResponse(ConfigAdd.java:18)
at com.heroku.api.connection.HttpClientConnection.execute(HttpClientConnection.java:87)
at com.heroku.api.HerokuAPI.addConfig(HerokuAPI.java:363)
at com.heroku.eclipse.core.services.rest.RestHerokuSession.addEnvVariables(RestHerokuSession.java:371)
at com.heroku.eclipse.core.services.rest.RestHerokuServices$26.run(RestHerokuServices.java:932)
at com.heroku.eclipse.core.services.rest.RestHerokuServices$30.run(RestHerokuServices.java:998)
The same goes when trying to remove such a variable:
Exception in thread "Thread-21" java.lang.IllegalArgumentException: Illegal character in path at index 56: https://api.heroku.com/apps/tomsontom1/config_vars/HÖHER $ UNDSO
at java.net.URI.create(URI.java:859)
at org.apache.http.client.methods.HttpDelete.<init>(HttpDelete.java:69)
at com.heroku.api.connection.HttpClientConnection.getHttpRequestBase(HttpClientConnection.java:102)
at com.heroku.api.connection.HttpClientConnection.execute(HttpClientConnection.java:63)
at com.heroku.api.HerokuAPI.removeConfig(HerokuAPI.java:382)
at com.heroku.eclipse.core.services.rest.RestHerokuSession.removeEnvVariable(RestHerokuSession.java:393)
at com.heroku.eclipse.core.services.rest.RestHerokuServices$28.run(RestHerokuServices.java:959)
at com.heroku.eclipse.core.services.rest.RestHerokuServices$30.run(RestHerokuServices.java:998)
Caused by: java.net.URISyntaxException: Illegal character in path at index 56: https://api.heroku.com/apps/tomsontom1/config_vars/HÖHER $ UNDSO
at java.net.URI$Parser.fail(URI.java:2829)
at java.net.URI$Parser.checkChars(URI.java:3002)
at java.net.URI$Parser.parseHierarchical(URI.java:3086)
at java.net.URI$Parser.parse(URI.java:3034)
at java.net.URI.<init>(URI.java:595)
at java.net.URI.create(URI.java:857)
Obviously the umlauts are not correctly escaped in the API. For the time being, I've added a check that allows only characters and numbers to be used.
I am able to add an env var named "FOO$ %BÄR" using https://api-docs.heroku.com/config#PUT/apps/config_vars, if I however try to do the same using HerokuAPI.addConfig, the API dies with a HTTP 400 error:
The same goes when trying to remove such a variable:
Obviously the umlauts are not correctly escaped in the API. For the time being, I've added a check that allows only characters and numbers to be used.