feat: Update smartregistry integration to support Uint8Array for body handling
This commit is contained in:
@@ -118,18 +118,16 @@ export class RegistryManager {
|
||||
});
|
||||
|
||||
// Read body for non-GET requests
|
||||
// IMPORTANT: smartregistry expects Buffer (not Uint8Array) for proper digest calculation
|
||||
// Buffer.isBuffer(Uint8Array) returns false, causing JSON.stringify which corrupts the data
|
||||
let body: Buffer | undefined;
|
||||
// smartregistry v2.2.0 handles Uint8Array natively for proper digest calculation
|
||||
let body: Uint8Array | undefined;
|
||||
if (req.method !== 'GET' && req.method !== 'HEAD') {
|
||||
const bodyData = await req.arrayBuffer();
|
||||
if (bodyData.byteLength > 0) {
|
||||
body = Buffer.from(bodyData);
|
||||
body = new Uint8Array(bodyData);
|
||||
}
|
||||
}
|
||||
|
||||
// smartregistry v2.0.0 handles JWT tokens natively - no decoding needed
|
||||
// Pass rawBody for content-addressable operations (manifest push needs exact bytes for digest)
|
||||
// smartregistry v2.2.0 handles JWT tokens natively and supports Uint8Array body
|
||||
const context = {
|
||||
method: req.method,
|
||||
path: url.pathname,
|
||||
|
||||
Reference in New Issue
Block a user