mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Fix setting None metadata from FILENAME_METADATA matches.
This is relevant when using optional items in the expression. E.g. if an optional captured group is not matched, the result of `match.groupdict()` contains the captured group with value `None`.
This commit is contained in:
parent
ee643d47d7
commit
4917b8618a
2 changed files with 39 additions and 1 deletions
|
|
@ -672,7 +672,7 @@ def parse_path_metadata(source_path, settings=None, process=None):
|
|||
# .items() for py3k compat.
|
||||
for k, v in match.groupdict().items():
|
||||
k = k.lower() # metadata must be lowercase
|
||||
if k not in metadata:
|
||||
if v is not None and k not in metadata:
|
||||
if process:
|
||||
v = process(k, v)
|
||||
metadata[k] = v
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue