瀏覽代碼

fix: discorrectly allowing upgrade plugin to another plugin_id

Yeuoly 9 月之前
父節點
當前提交
cea4cb0e1a
共有 1 個文件被更改,包括 4 次插入0 次删除
  1. 4 0
      internal/service/install_plugin.go

+ 4 - 0
internal/service/install_plugin.go

@@ -300,6 +300,10 @@ func UpgradePlugin(
 		return entities.NewErrorResponse(-400, "original and new plugin unique identifier are the same")
 		return entities.NewErrorResponse(-400, "original and new plugin unique identifier are the same")
 	}
 	}
 
 
+	if original_plugin_unique_identifier.PluginID() != new_plugin_unique_identifier.PluginID() {
+		return entities.NewErrorResponse(-400, "original and new plugin id are different")
+	}
+
 	// uninstall the original plugin
 	// uninstall the original plugin
 	installation, err := db.GetOne[models.PluginInstallation](
 	installation, err := db.GetOne[models.PluginInstallation](
 		db.Equal("tenant_id", tenant_id),
 		db.Equal("tenant_id", tenant_id),