You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
BoxAPIResponse getHeaderField should be case insensitive #619
LargeFileUpload.upload() calls are failing because they fail to parse the Retry-After header from the commit response. This is because the headers are stored and looked up in a case-sensitive way. But as per HTTP spec (https://tools.ietf.org/html/rfc2616#section-4.2) header names are case-insensitive. This causes problems since BoxFileUploadSession.commit calls response.getHeaderField("retry-after") but the response from the server may have the header name as "Retry-After".
This leads to an exception (see stack trace below).
Fix should be pretty simple, use a case-insensitive map or all keys should be converted to lowercase before insertion/lookup in the map.
Exception in thread "main" com.box.sdk.BoxAPIException: Unable to commit the upload session
at com.box.sdk.LargeFileUpload.uploadHelper(LargeFileUpload.java:136)
at com.box.sdk.LargeFileUpload.upload(LargeFileUpload.java:112)
at Main$.$anonfun$main$1(Main.scala:21)
at scala.collection.immutable.Range.foreach$mVc$sp(Range.scala:156)
at Main$.main(Main.scala:14)
at Main.main(Main.scala)
Caused by: com.box.sdk.BoxAPIException: Commit response content type is not application/json. The response code : 202
at com.box.sdk.BoxFileUploadSession.commit(BoxFileUploadSession.java:372)
at com.box.sdk.LargeFileUpload.uploadHelper(LargeFileUpload.java:133)
... 5 more
Activity
carycheng commentedon Jun 26, 2018
Hey @klk-
Thank you for pointing this out, we have a pr out for this fix now - #620
This fix will most likely go out with our weekly SDK release on Thursday.
Thanks!
mattwiller commentedon Jun 27, 2018
Fixed by #620