From 68a5b2be65217863f4b40eb9543eb38e739ea3f7 Mon Sep 17 00:00:00 2001 From: Eloi Torrents Date: Sat, 6 Sep 2025 09:58:40 +0200 Subject: [PATCH] Fix gallery_path --- src/microblog.py | 1 + src/rss.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/microblog.py b/src/microblog.py index 03c7309..1bb197b 100644 --- a/src/microblog.py +++ b/src/microblog.py @@ -550,6 +550,7 @@ if __name__ == "__main__": updated += writepage(tpl, tl, tc, cfg["page"], paginate=True if new_posts is None else False) cfg["rss"]["accepted_images"] = cfg["post"]["accepted_images"] + cfg["rss"]["gallery_path"] = cfg["post"]["gallery"]["path_to_fullsize"] if cfg["rss"]["enabled"]: # ensure output directory for feeds exists if not os.path.exists("feeds"): diff --git a/src/rss.py b/src/rss.py index f5dd3e3..886d027 100644 --- a/src/rss.py +++ b/src/rss.py @@ -43,7 +43,7 @@ def _is_image_token(token: str, extensions): def enrich_msg( lines, accepted_images=[], - base_url="", + gallery_path="", trailing_punctuation="", desc_len_limit=-1, ): @@ -66,7 +66,7 @@ def enrich_msg( words[i] = new_word elif _is_image_token(core, accepted_images): suffix = word[len(core):] - abs_url = urljoin(base_url, core) + abs_url = urljoin(gallery_path, core) anchor = f"{escape(abs_url)}" new_word = anchor + suffix words[i] = new_word @@ -115,7 +115,9 @@ def write_feed(posts, filename, params, tagname=None): de = " ".join( enrich_msg( msg, - base_url=params["url"], + gallery_path=urljoin( + params["url"], params.get("gallery_path", "") + "/" + ), accepted_images=params["accepted_images"], trailing_punctuation=params["trailing_punctuation"], desc_len_limit=DESC_LEN_LIMIT,