Merge pull request #13827 from shariquerik/image-error-message

fix: Better error message while uploading web image
This commit is contained in:
mergify[bot] 2021-08-05 08:01:20 +00:00 committed by GitHub
commit 85d0e44619
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -703,7 +703,10 @@ def get_web_image(file_url):
frappe.msgprint(_("Unable to read file format for {0}").format(file_url))
raise
image = Image.open(StringIO(frappe.safe_decode(r.content)))
try:
image = Image.open(StringIO(frappe.safe_decode(r.content)))
except Exception as e:
frappe.msgprint(_("Image link '{0}' is not valid").format(file_url), raise_exception=e)
try:
filename, extn = file_url.rsplit("/", 1)[1].rsplit(".", 1)