From: Swaraj Kumar Date: Tue, 21 Oct 2025 11:03:45 +0000 (+0530) Subject: UploadModel uploads with incorrect artifact ver X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=commitdiff_plain;h=f80a8a35d415a96cd104665bfb41c154ec103067;p=aiml-fw%2Fawmf%2Fmodelmgmtservice.git UploadModel uploads with incorrect artifact ver ModelKey is updated to use the newArtifactversion instead of artifactVersion. Model Artifact updation is carried out first and then the modelKey is set. Issue-ID: AIMLFW-304 and AIMLFW-282 Change-Id: I71d626a419c1b273db89c4115f4b04656765d8de Signed-off-by: Swaraj Kumar --- diff --git a/apis/mmes_apis.go b/apis/mmes_apis.go index 34e20e7..3c22883 100644 --- a/apis/mmes_apis.go +++ b/apis/mmes_apis.go @@ -336,8 +336,6 @@ func (m *MmeApiHandler) UploadModel(cont *gin.Context) { } artifactVersion := modelInfo.ModelId.ArtifactVersion - modelKey := fmt.Sprintf("%s_%s_%s", modelName, modelVersion, artifactVersion) - exportBucket := strings.ToLower(modelName) // Update the Artifact-Version newArtifactVersion, err := utils.IncrementArtifactVersion(artifactVersion) if err != nil { @@ -350,6 +348,9 @@ func (m *MmeApiHandler) UploadModel(cont *gin.Context) { }) return } + modelKey := fmt.Sprintf("%s_%s_%s", modelName, modelVersion, newArtifactVersion) + exportBucket := strings.ToLower(modelName) + modelInfo.ModelId.ArtifactVersion = newArtifactVersion if err := m.iDB.Update(*modelInfo); err != nil { statusCode := http.StatusInternalServerError