fix:优化图片缩放
This commit is contained in:
parent
aa4a48b68a
commit
4d443e9cc3
|
@ -61,7 +61,7 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata
|
|||
return err
|
||||
}
|
||||
var newResourceMetadata string
|
||||
if oldResource.Metadata != nil && *oldResource.Metadata != "{}" {
|
||||
if oldResource.Metadata != nil && *oldResource.Metadata != "{}" && *oldResource.Metadata != "" {
|
||||
var oldResourceMetadata map[string]interface{}
|
||||
err = json.Unmarshal([]byte(*oldResource.Metadata), &oldResourceMetadata)
|
||||
if err != nil {
|
||||
|
@ -72,8 +72,8 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata
|
|||
switch val := v.(type) {
|
||||
case map[string]interface{}:
|
||||
oldResourceMetadataData := oldResourceMetadata[k].(map[string]interface{})
|
||||
for key := range val {
|
||||
oldResourceMetadataData[key] = val
|
||||
for key, val1 := range val {
|
||||
oldResourceMetadataData[key] = val1
|
||||
}
|
||||
oldResourceMetadata[k] = oldResourceMetadataData
|
||||
}
|
||||
|
@ -90,8 +90,8 @@ func (d *defaultResource) UpdateMetadata(ctx context.Context, in *UpdateMetadata
|
|||
switch val := v.(type) {
|
||||
case map[string]interface{}:
|
||||
var resourceMetadataData = make(map[string]interface{}, len(val))
|
||||
for key := range val {
|
||||
resourceMetadataData[key] = val
|
||||
for key, val1 := range val {
|
||||
resourceMetadataData[key] = val1
|
||||
}
|
||||
resourceMetadata[k] = resourceMetadataData
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user