mirror of
https://github.com/Joxit/docker-registry-ui.git
synced 2025-04-27 15:39:54 +03:00
[http] use Docker-Content-Digest header instead of ETag
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
This commit is contained in:
parent
04f4c204d8
commit
a2e81ac12c
4 changed files with 6 additions and 8 deletions
2
dist/scripts/docker-registry-ui-static.js
vendored
2
dist/scripts/docker-registry-ui-static.js
vendored
File diff suppressed because one or more lines are too long
2
dist/scripts/docker-registry-ui.js
vendored
2
dist/scripts/docker-registry-ui.js
vendored
File diff suppressed because one or more lines are too long
|
@ -23,12 +23,10 @@ function Http() {
|
|||
}
|
||||
|
||||
Http.prototype.getContentDigest = function(cb) {
|
||||
const headers = this.oReq.getAllResponseHeaders();
|
||||
const start = headers.indexOf('etag: "sha256:');
|
||||
if (start !== -1) {
|
||||
if (this.oReq.hasHeader('Docker-Content-Digest')) {
|
||||
// Same origin or advanced CORS headers set:
|
||||
// 'Access-Control-Expose-Headers: ETag'
|
||||
cb(headers.slice(start + 7, headers.indexOf('"', start + 7)))
|
||||
// 'Access-Control-Expose-Headers: Docker-Content-Digest'
|
||||
cb(this.oReq.getResponseHeader('Docker-Content-Digest'))
|
||||
} else if (window.crypto && window.TextEncoder) {
|
||||
crypto.subtle.digest(
|
||||
'SHA-256',
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
if (!self.dockerCmd) {
|
||||
registryUI.errorSnackbar(
|
||||
'Your browser has no SHA256 support. As a workaround your registry ' +
|
||||
' can set the header `Access-Control-Expose-Headers: ETag`.'
|
||||
' can set the header `Access-Control-Expose-Headers: Docker-Content-Digest`.'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue