Skip to content

Commit c30b069

Browse files
committed
fix: trim content-length header value
1 parent 7f49443 commit c30b069

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/com/box/sdk/BinaryBodyUtils.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,10 @@ private static long getContentLengthFromAPIResponse(BoxAPIResponse response) {
101101

102102
if (headerValue != null) {
103103
try {
104-
length = Long.parseLong(headerValue);
104+
length = Long.parseLong(headerValue.trim());
105105
} catch (NumberFormatException e) {
106-
throw new RuntimeException("Invalid content length: " + headerValue);
106+
throw new RuntimeException("Invalid content length: " + headerValue.trim() + "with: "
107+
+ headerValue.trim().length() + "number of characters.");
107108
}
108109
}
109110
}

0 commit comments

Comments
 (0)