Skip to content

Commit

Permalink
Merge pull request #821 from nextcloud/backport/820/stable-2.9
Browse files Browse the repository at this point in the history
[stable-2.9] RemoteOperationResult: ignore location header if there are authentication headers present
  • Loading branch information
AlvaroBrey authored Feb 18, 2022
2 parents 278838c + 41affe7 commit 64ec4ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,10 @@ public RemoteOperationResult(boolean success, int httpCode, String httpPhrase, H
Header current;
for (Header httpHeader : httpHeaders) {
current = httpHeader;
if (HEADER_LOCATION.equals(current.getName().toLowerCase(Locale.US))) {
mRedirectedLocation = current.getValue();
} else if (HEADER_WWW_AUTHENTICATE.equals(current.getName().toLowerCase(Locale.US))) {
if (HEADER_WWW_AUTHENTICATE.equals(current.getName().toLowerCase(Locale.US))) {
mAuthenticateHeaders.add(current.getValue());
} else if (HEADER_LOCATION.equals(current.getName().toLowerCase(Locale.US)) && mAuthenticateHeaders.isEmpty()) {
mRedirectedLocation = current.getValue();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class RemoteOperationResultTest {
)
Assert.assertEquals(
"Wrong location header",
LOCATION_HEADER.value,
null,
sut.redirectedLocation
)
}
Expand Down

0 comments on commit 64ec4ed

Please sign in to comment.