Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix image update mutation to ignore alt if it wasn't provided

Marcin Gębalab5279fcc5ac7
diff --git a/saleor/graphql/product/mutations/products.py b/saleor/graphql/product/mutations/products.py
index f9e2c7956b..301514b42c 100644
--- a/saleor/graphql/product/mutations/products.py
+++ b/saleor/graphql/product/mutations/products.py
@@ -611,8 +611,10 @@ class ProductImageUpdate(BaseMutation):
info, id, errors, 'id', only_type=ProductImage)
product = image.product
if not errors:
- image.alt = input.get('alt', '')
- image.save()
+ alt = input.get('alt')
+ if alt is not None:
+ image.alt = alt
+ image.save(update_fields=['alt'])
return ProductImageUpdate(product=product, image=image, errors=errors)