Skip to content

fix: crash on jpeg files in itunes_image #144

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions feedgen/ext/podcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def itunes_image(self, itunes_image=None):
the accompanying image must be at least 1400x1400 pixels.

iTunes supports images in JPEG and PNG formats with an RGB color space
(CMYK is not supported). The URL must end in ".jpg" or ".png". If the
(CMYK is not supported). The URL must end in ".jpg", ".jpeg" or ".png". If the
<itunes:image> tag is not present, iTunes will use the contents of the
RSS image tag.

Expand All @@ -212,10 +212,10 @@ def itunes_image(self, itunes_image=None):
:returns: Image of the podcast.
'''
if itunes_image is not None:
if itunes_image.endswith('.jpg') or itunes_image.endswith('.png'):
if itunes_image.endswith('.jpg') or itunes_image.endswith('.png') or itunes_image.endswith('.jpeg'):
self.__itunes_image = itunes_image
else:
ValueError('Image file must be png or jpg')
ValueError('Image file must be png, jpg or jpeg')
return self.__itunes_image

def itunes_explicit(self, itunes_explicit=None):
Expand Down
6 changes: 3 additions & 3 deletions feedgen/ext/podcast_entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def itunes_image(self, itunes_image=None):
pixels.

iTunes supports images in JPEG and PNG formats with an RGB color space
(CMYK is not supported). The URL must end in ".jpg" or ".png". If the
(CMYK is not supported). The URL must end in ".jpg", ".jpeg" or ".png". If the
<itunes:image> tag is not present, iTunes will use the contents of the
RSS image tag.

Expand All @@ -147,10 +147,10 @@ def itunes_image(self, itunes_image=None):
:returns: Image of the podcast.
'''
if itunes_image is not None:
if itunes_image.endswith('.jpg') or itunes_image.endswith('.png'):
if itunes_image.endswith('.jpg') or itunes_image.endswith('.png') or itunes_image.endswith('.jpeg'):
self.__itunes_image = itunes_image
else:
raise ValueError('Image file must be png or jpg')
raise ValueError('Image file must be png, jpg or jpeg')
return self.__itunes_image

def itunes_duration(self, itunes_duration=None):
Expand Down