fix: password not saved correctly when editing asset
This commit is contained in:
+11
-1
@@ -212,7 +212,7 @@ func (assetApi AssetApi) AssetGetEndpoint(c echo.Context) (err error) {
|
||||
id := c.Param("id")
|
||||
|
||||
var item model.Asset
|
||||
if item, err = service.AssetService.FindByIdAndDecrypt(context.TODO(), id); err != nil {
|
||||
if item, err = repository.AssetRepository.FindById(context.TODO(), id); err != nil {
|
||||
return err
|
||||
}
|
||||
attributeMap, err := repository.AssetRepository.FindAssetAttrMapByAssetId(context.TODO(), id)
|
||||
@@ -224,6 +224,16 @@ func (assetApi AssetApi) AssetGetEndpoint(c echo.Context) (err error) {
|
||||
itemMap[key] = attributeMap[key]
|
||||
}
|
||||
|
||||
if item.Password != "" && item.Password != "-" {
|
||||
itemMap["password"] = ""
|
||||
}
|
||||
if item.PrivateKey != "" && item.PrivateKey != "-" {
|
||||
itemMap["privateKey"] = ""
|
||||
}
|
||||
if item.Passphrase != "" && item.Passphrase != "-" {
|
||||
itemMap["passphrase"] = ""
|
||||
}
|
||||
|
||||
return Success(c, itemMap)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user