OneDrive / onedrive-sdk-android

OneDrive SDK for Android!
https://dev.onedrive.com
Other
148 stars 52 forks source link

OneDrive Service exception Error code: Unable to parse error response message #53

Closed sw-dev1 closed 8 years ago

sw-dev1 commented 8 years ago

The error is persistent for a certain file when trying to upload. Two problems with this: 1) is the request faulty and if yes, where? Why is the response also faulty? 2) although the request is made from a try block, the ClientException is not caught in the catch block. Logcat: https://gist.github.com/sw-dev1/73131f9e7c6bbfb15862

sw-dev1 commented 8 years ago

Most likely cause of this error seems to be a long file name with spaces or characters not allowed in a HTTP request. Are there requirements for pre-handling of file names that I might have missed? A possible workaround is to use java.net.URLencode as pre-handling. The error does not occur. But this leads to server items created with + in the name instead of space. Any ideas how to move forward on (or around) this?

peternied commented 8 years ago

Thanks for the report, the source of the problem is that the filename contains invalid characters for a request url, you should be able to URL encode the file name to prevent this problem.

To the error message, we are getting an xml error from a much lower part of our framework that routes requests which is why the json parsing fails. Thanks for reporting.

sw-dev1 commented 8 years ago

Great that this is solved. Would you recommend java.net.URLencode for URL encoding? Would names of items be then decoded correctly? I saw server items being created with + in the name instead of space when using java.net.URLencode.