Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,17 @@ final class JsonResumableSessionQueryTask
} else {
HttpResponseException cause = new HttpResponseException(response);
String contentType = response.getHeaders().getContentType();
Long contentLength = response.getHeaders().getContentLength();
// If the content-range header value has run ahead of the backend, it will respond with
// a 503 with plain text content
// Attempt to detect this very loosely as to minimize impact of modified error message
// This is accurate circa 2023-06
if ((!ResumableSessionFailureScenario.isOk(code)
&& !ResumableSessionFailureScenario.isContinue(code))
&& contentType != null
&& contentType.startsWith("text/plain")) {
&& contentType.startsWith("text/plain")
&& contentLength != null
&& contentLength > 0) {
String errorMessage = cause.getContent().toLowerCase(Locale.US);
if (errorMessage.contains("content-range")) {
throw ResumableSessionFailureScenario.SCENARIO_5.toStorageException(
Expand Down