Skip to content

Commit

Permalink
Merge pull request #3674 from tartley/inject-webp-mimetype
Browse files Browse the repository at this point in the history
Fix exception from gallery RSS with WebP images
  • Loading branch information
Kwpolska committed Apr 8, 2023
2 parents 2b01fa1 + 006d1f5 commit c194a60
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
* `Jesper Dramsch <https://github.com/jesperdramsch>`_
* `John Kristensen <https://github.com/jerrykan>`_
* `Jonathon Anderson <https://github.com/anderbubble>`_
`Jonathan Hartley <https://github.com/tartley>`_
* `Joshua Barratt <https://github.com/jbarratt>`_
* `Juan Pedro Fisanotti <https://github.com/fisadev>`_
* `Juanjo Conti <https://github.com/jjconti>`_
Expand Down
2 changes: 2 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Features
Bug Fixes
---------

* Fix RSS generation of galleries containing WebP images, which caused
an unhandled exception due to not having a known MIME type (Issue #3671)
* Fix ``auto`` command infinite loop (Issue #3677)
* Fix API URL in CSS and JS minifiers (Issue #3658)
* Fix ``:align: center`` for images in reST (Issue #3657)
Expand Down
2 changes: 1 addition & 1 deletion nikola/data/samplesite/galleries/demo/metadata.sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ order: 2
name: tesla4_lg.jpg
order: 0
---
name: tesla_conducts_lg.jpg
name: tesla_conducts_lg.webp
caption: Nikola Tesla conducts electricity
order: 1
---
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions nikola/nikola.py
Original file line number Diff line number Diff line change
Expand Up @@ -891,6 +891,7 @@ def __init__(self, **config):
utils.LOGGER.warning('You are currently disabling "{}", but not the following new taxonomy plugins: {}'.format(old_plugin_name, ', '.join(missing_plugins)))
utils.LOGGER.warning('Please also disable these new plugins or remove "{}" from the DISABLED_PLUGINS list.'.format(old_plugin_name))
self.config['DISABLED_PLUGINS'].extend(missing_plugins)

# Special-case logic for "render_indexes" to fix #2591
if 'render_indexes' in self.config['DISABLED_PLUGINS']:
if 'generate_rss' in self.config['DISABLED_PLUGINS'] or self.config['GENERATE_RSS'] is False:
Expand Down Expand Up @@ -1000,6 +1001,9 @@ def __init__(self, **config):
self.state._set_site(self)
self.cache._set_site(self)

# WebP files have no official MIME type yet, but we need to recognize them (Issue #3671)
mimetypes.add_type('image/webp', '.webp')

def _filter_duplicate_plugins(self, plugin_list):
"""Find repeated plugins and discard the less local copy."""
def plugin_position_in_places(plugin):
Expand Down

0 comments on commit c194a60

Please sign in to comment.