handle paths and extensions properly, fix #41

This commit is contained in:
rra 2022-09-09 14:19:19 +02:00
parent 657ced1ceb
commit 0ecc0ecd3a

View File

@ -138,9 +138,9 @@ def create_event_post(post_dir, event):
for img in event_metadata["images"]:
# parse img url to safe local image name
img_name = img.split("/")[-1]
fn, ext = img_name.split(".")
img_name = slugify(fn) + "." + ext
img_name = os.path.basename(img)
fn, ext = os.path.splitext(img_name)
img_name = slugify(fn) + '.' + ext
local_image = os.path.join(post_dir, img_name)