fix(core): Normalize binary data handling across registries and add buffer helpers

This commit is contained in:
2025-11-25 22:35:31 +00:00
parent e81fa41b18
commit a78934836e
10 changed files with 1496 additions and 9 deletions

View File

@@ -7,6 +7,7 @@ import { BaseRegistry } from '../core/classes.baseregistry.js';
import type { RegistryStorage } from '../core/classes.registrystorage.js';
import type { AuthManager } from '../core/classes.authmanager.js';
import type { IRequestContext, IResponse, IAuthToken } from '../core/interfaces.core.js';
import { toBuffer } from '../core/helpers.buffer.js';
import type { IMavenCoordinate, IMavenMetadata, IChecksums } from './interfaces.maven.js';
import {
pathToGAV,
@@ -296,7 +297,7 @@ export class MavenRegistry extends BaseRegistry {
coordinate: IMavenCoordinate,
body: Buffer | any
): Promise<IResponse> {
const data = Buffer.isBuffer(body) ? body : Buffer.from(JSON.stringify(body));
const data = toBuffer(body);
// Validate POM if uploading .pom file
if (coordinate.extension === 'pom') {