Pass cookies when fetching binary files
Some Gerrit instances will require cookies in order to serve binary
content requests, but the use of `fetch` for `_fetchB64File` in
GR-REST-API-INTERFACE did not have the credential option set, and would
fail on such instances. With this change the credentials option is set.
Bug: Issue 5371
Change-Id: I5f8e8fd74bb3775bda00217fabac38031d010e05
diff --git a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
index d32ff75..4d64a77 100644
--- a/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
+++ b/polygerrit-ui/app/elements/shared/gr-rest-api-interface/gr-rest-api-interface.js
@@ -890,7 +890,7 @@
},
_fetchB64File: function(url) {
- return fetch(url).then(function(response) {
+ return fetch(url, {credentials: 'same-origin'}).then(function(response) {
var type = response.headers.get('X-FYI-Content-Type');
return response.text()
.then(function(text) {