use buffer for content

This commit is contained in:
James Brumond 2023-08-18 22:52:25 -07:00
parent efaa2aa24d
commit 4ec5cfd721
Signed by: james
GPG Key ID: E8F2FC44BAA3357A
3 changed files with 7 additions and 5 deletions

5
dist/index.js vendored
View File

@ -2945,9 +2945,10 @@ async function get_manifest(input) {
async function put_manifest(new_tag, manifest, input) {
const path = `/v2/${input.manifest.image}/manifests/${new_tag}`;
const content = Buffer.from(manifest, 'utf8');
const req_headers = {
'content-type': manifest_media_type,
'content-length': Buffer.byteLength(manifest),
'content-length': content.byteLength,
};
http_basic_auth(req_headers, input);
@ -2956,7 +2957,7 @@ async function put_manifest(new_tag, manifest, input) {
// req_headers.authorization = `Bearer ${input.token}`;
// }
const { status, headers, body } = await http_req('PUT', input.registry_url + path, req_headers, manifest);
const { status, headers, body } = await http_req('PUT', input.registry_url + path, req_headers, content);
if (status >= 400) {
console.error('put manifest response', { status, headers, body });

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -84,9 +84,10 @@ async function get_manifest(input) {
async function put_manifest(new_tag, manifest, input) {
const path = `/v2/${input.manifest.image}/manifests/${new_tag}`;
const content = Buffer.from(manifest, 'utf8');
const req_headers = {
'content-type': manifest_media_type,
'content-length': Buffer.byteLength(manifest),
'content-length': content.byteLength,
};
http_basic_auth(req_headers, input);
@ -95,7 +96,7 @@ async function put_manifest(new_tag, manifest, input) {
// req_headers.authorization = `Bearer ${input.token}`;
// }
const { status, headers, body } = await http_req('PUT', input.registry_url + path, req_headers, manifest);
const { status, headers, body } = await http_req('PUT', input.registry_url + path, req_headers, content);
if (status >= 400) {
console.error('put manifest response', { status, headers, body });