Skip to content

Commit 1508c37

Browse files
authored
Merge pull request #15829 from iterate-ch/bugfix/MD-21270
Do not add bearer authorization for pre-authenticated download URLs.
2 parents 5a21ceb + 2cb4516 commit 1508c37

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

onedrive/src/main/java/ch/cyberduck/core/onedrive/GraphSession.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262
import java.util.Optional;
6363
import java.util.Set;
6464

65+
import static org.apache.http.client.protocol.HttpClientContext.REDIRECT_LOCATIONS;
66+
6567
public abstract class GraphSession extends HttpSession<OneDriveAPI> {
6668
private static final Logger log = LogManager.getLogger(GraphSession.class);
6769

@@ -135,7 +137,12 @@ protected OneDriveAPI connect(final Proxy proxy, final HostKeyCallback key, fina
135137
@Override
136138
public void process(final HttpRequest request, final HttpContext context) throws HttpException, IOException {
137139
if(request.containsHeader(HttpHeaders.AUTHORIZATION)) {
138-
super.process(request, context);
140+
if(context.getAttribute(REDIRECT_LOCATIONS) == null) {
141+
super.process(request, context);
142+
}
143+
else {
144+
request.removeHeaders(HttpHeaders.AUTHORIZATION);
145+
}
139146
}
140147
}
141148
}.withRedirectUri(host.getProtocol().getOAuthRedirectUrl())

0 commit comments

Comments
 (0)