Skip to content

Commit

Permalink
Do not fail if an image do not have a src attribute
Browse files Browse the repository at this point in the history
Refs. #30
  • Loading branch information
hvelarde committed Oct 10, 2016
1 parent fc8fdbf commit 15ba699
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ There's a frood who really knows where his towel is.
1.0a3 (unreleased)
------------------

- Do not fail if an image was referenced inside the body text as an external resource.
- Do not fail if an image doesn't have a ``src`` attribute,
or if it was referenced inside the body text as an external resource.
[hvelarde]

- Clean up invalid AMP HTML attributes (fixes `#26`_).
Expand Down
5 changes: 5 additions & 0 deletions src/collective/behavior/amp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def transform_img_tags(self, el):
try:
# src="resolveuid/979bede6b93e46d386be493d852ed744"
uuid = tag.attrib['src'].split('/')[1]
except KeyError:
# FIXME: the image has no src attribute; we should log
# an error message referencing the context
# https://github.com/collective/collective.behavior.amp/issues/30
continue
except IndexError:
# FIXME: what we should do if the <img> tag references
# an external resource?
Expand Down

0 comments on commit 15ba699

Please sign in to comment.