stash
This commit is contained in:
parent
8d96bc97c4
commit
ed04d98bf1
54 changed files with 661 additions and 1214 deletions
|
|
@ -38,9 +38,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
const data = new Uint8Array(buffer);
|
||||
// SHA-256 via Web Crypto - must match the backend's own content hash
|
||||
// (files/models.py, hashlib.sha256) so a hash computed here can later be
|
||||
// used to identify the same File row server-side without a mismatch.
|
||||
// SHA-256 must match the backend's content hash for file identification. See docs/implementation.md#sha-256-file-hashing-must-match-the-backend.
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
||||
const hash = Array.from(new Uint8Array(hashBuffer))
|
||||
.map(b => b.toString(16).padStart(2, "0")).join("");
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
const data = new Uint8Array(buffer);
|
||||
// SHA-256 via Web Crypto - must match the backend's own content hash
|
||||
// (files/models.py, hashlib.sha256) so a hash computed here can later
|
||||
// be used to identify the same File row server-side without a mismatch.
|
||||
// SHA-256 must match the backend's content hash for file identification. See docs/implementation.md#sha-256-file-hashing-must-match-the-backend.
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
||||
const hash = Array.from(new Uint8Array(hashBuffer))
|
||||
.map(b => b.toString(16).padStart(2, "0")).join("");
|
||||
|
|
|
|||
|
|
@ -41,9 +41,7 @@ export default {
|
|||
return;
|
||||
}
|
||||
const data = new Uint8Array(buffer);
|
||||
// SHA-256 via Web Crypto - must match the backend's own content hash
|
||||
// (files/models.py, hashlib.sha256) so a hash computed here can later be
|
||||
// used to identify the same File row server-side without a mismatch.
|
||||
// SHA-256 must match the backend's content hash for file identification. See docs/implementation.md#sha-256-file-hashing-must-match-the-backend.
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
||||
const hash = Array.from(new Uint8Array(hashBuffer))
|
||||
.map(b => b.toString(16).padStart(2, "0")).join("");
|
||||
|
|
|
|||
|
|
@ -206,9 +206,7 @@ export default {
|
|||
const mimeType = this.dataImage.split(';')[0].split(':')[1];
|
||||
const data = this.dataImage.split(',')[1];
|
||||
const raw_data = atob(data);
|
||||
// SHA-256 via Web Crypto - must match the backend's own content hash (files/models.py,
|
||||
// hashlib.sha256) so a hash computed here can later be used to identify the same File
|
||||
// row server-side without a mismatch.
|
||||
// SHA-256 must match the backend's content hash for file identification. See docs/implementation.md#sha-256-file-hashing-must-match-the-backend.
|
||||
const bytes = Uint8Array.from(raw_data, c => c.charCodeAt(0));
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', bytes);
|
||||
const hash = Array.from(new Uint8Array(hashBuffer))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue