mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Prevent people from setting STATIC_PATHS to a str
Previously you could accidentally set for example site/css and pelican would iterate through the string and attempt to copy '/' into your output.
This commit is contained in:
parent
5e4622b229
commit
bd54cb1b88
2 changed files with 26 additions and 0 deletions
|
|
@ -234,4 +234,14 @@ def configure_settings(settings):
|
|||
settings['FILENAME_METADATA'] = (
|
||||
_DEFAULT_CONFIG['FILENAME_METADATA'])
|
||||
|
||||
# Save people from accidentally setting site/css vs [site/css]
|
||||
path_keys = ['STATIC_PATHS', 'THEME_STATIC_PATHS']
|
||||
for PATH_KEY in filter(lambda k: k in settings, path_keys):
|
||||
if isinstance(settings[PATH_KEY], six.string_types):
|
||||
logger.warn("Detected misconfiguration with %s setting (must "
|
||||
"be a list of paths), falling back to the default"
|
||||
% PATH_KEY)
|
||||
settings[PATH_KEY] = \
|
||||
_DEFAULT_CONFIG[PATH_KEY]
|
||||
|
||||
return settings
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue