feat(core/registrystorage): Persist OCI manifest content-type in sidecar and normalize manifest body handling
This commit is contained in:
@@ -129,7 +129,7 @@ export class RegistryStorage implements IStorageBackend {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get OCI manifest
|
||||
* Get OCI manifest and its content type
|
||||
*/
|
||||
public async getOciManifest(repository: string, digest: string): Promise<Buffer | null> {
|
||||
const path = this.getOciManifestPath(repository, digest);
|
||||
@@ -137,7 +137,17 @@ export class RegistryStorage implements IStorageBackend {
|
||||
}
|
||||
|
||||
/**
|
||||
* Store OCI manifest
|
||||
* Get OCI manifest content type
|
||||
* Returns the stored content type or null if not found
|
||||
*/
|
||||
public async getOciManifestContentType(repository: string, digest: string): Promise<string | null> {
|
||||
const typePath = this.getOciManifestPath(repository, digest) + '.type';
|
||||
const data = await this.getObject(typePath);
|
||||
return data ? data.toString('utf-8') : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Store OCI manifest with its content type
|
||||
*/
|
||||
public async putOciManifest(
|
||||
repository: string,
|
||||
@@ -146,7 +156,11 @@ export class RegistryStorage implements IStorageBackend {
|
||||
contentType: string
|
||||
): Promise<void> {
|
||||
const path = this.getOciManifestPath(repository, digest);
|
||||
return this.putObject(path, data, { 'Content-Type': contentType });
|
||||
// Store manifest data
|
||||
await this.putObject(path, data, { 'Content-Type': contentType });
|
||||
// Store content type in sidecar file for later retrieval
|
||||
const typePath = path + '.type';
|
||||
await this.putObject(typePath, Buffer.from(contentType, 'utf-8'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user