Fix PackageArtifactResponse missing sha256 and version fields
- Add sha256 field to list_package_artifacts response (artifact ID is SHA256) - Add version field to PackageArtifactResponse schema - Add version field to frontend PackageArtifact type - Update getArtifactVersion to prefer direct version field
This commit is contained in:
@@ -4817,9 +4817,13 @@ def list_package_artifacts(
|
||||
artifact_responses.append(
|
||||
PackageArtifactResponse(
|
||||
id=artifact.id,
|
||||
sha256=artifact.id, # Artifact ID is the SHA256 hash
|
||||
size=artifact.size,
|
||||
content_type=artifact.content_type,
|
||||
original_name=artifact.original_name,
|
||||
checksum_md5=artifact.checksum_md5,
|
||||
checksum_sha1=artifact.checksum_sha1,
|
||||
s3_etag=artifact.s3_etag,
|
||||
created_at=artifact.created_at,
|
||||
created_by=artifact.created_by,
|
||||
format_metadata=artifact.format_metadata,
|
||||
|
||||
@@ -256,6 +256,7 @@ class PackageArtifactResponse(BaseModel):
|
||||
created_at: datetime
|
||||
created_by: str
|
||||
format_metadata: Optional[Dict[str, Any]] = None
|
||||
version: Optional[str] = None # Version from PackageVersion if exists
|
||||
|
||||
class Config:
|
||||
from_attributes = True
|
||||
|
||||
@@ -313,9 +313,9 @@ function PackagePage() {
|
||||
}
|
||||
};
|
||||
|
||||
// Helper to get version from artifact metadata
|
||||
// Helper to get version from artifact - prefer direct version field, fallback to metadata
|
||||
const getArtifactVersion = (a: PackageArtifact): string | null => {
|
||||
return (a.format_metadata?.version as string) || null;
|
||||
return a.version || (a.format_metadata?.version as string) || null;
|
||||
};
|
||||
|
||||
// Helper to get download ref - prefer version, fallback to artifact ID
|
||||
|
||||
@@ -58,6 +58,7 @@ export interface PackageArtifact {
|
||||
created_at: string;
|
||||
created_by: string;
|
||||
format_metadata?: Record<string, unknown> | null;
|
||||
version?: string | null; // Version from PackageVersion if exists
|
||||
}
|
||||
|
||||
export interface PackageVersion {
|
||||
|
||||
Reference in New Issue
Block a user