UploadModel uploads with incorrect artifact ver 67/15167/1
authorSwaraj Kumar <swaraj.kumar@samsung.com>
Tue, 21 Oct 2025 11:03:45 +0000 (16:33 +0530)
committerSwaraj Kumar <swaraj.kumar@samsung.com>
Tue, 21 Oct 2025 11:03:45 +0000 (16:33 +0530)
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 <swaraj.kumar@samsung.com>
apis/mmes_apis.go

index 34e20e7..3c22883 100644 (file)
@@ -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