commit ff1d2e468b1dd5a2917296629ae384164a548c08 from: Aleksey Ryndin date: Mon Oct 21 06:04:03 2024 UTC Fix: donk URL can by relative commit - 7b47cf96e8cdf031d0af7d0f6a6428c75088b9a8 commit + ff1d2e468b1dd5a2917296629ae384164a548c08 blob - f408360f43b59d6bf65e7e9680bafc9e2fadab31 blob + 1160357735a999d8ec4a8e04596b8784603cf7b0 --- lonk.py +++ lonk.py @@ -285,9 +285,13 @@ def print_gethonks(gethonks_answer, lonk_url, honk_url lines.append("") lines.append(HtmlToGmi(honk_url.build(), lonk_url.media).feed(honk["HTML"])) for donk in honk.get("Donks") or []: - donk_url = honk_url.build(path=f'/d/{donk["XID"]}') if donk.get("XID") else donk["URL"] - donk_mime, donk_text = donk["Media"], donk.get("Desc") or donk.get("Name") or None + if donk.get("XID"): + donk_url = honk_url.build(path=f'/d/{donk["XID"]}') + else: + donk_url = urljoin(honk["XID"], donk["URL"]) + donk_mime = donk["Media"] lines.append(f'=> {lonk_url.media(donk_mime, donk_url)} {donk_url}') + donk_text = donk.get("Desc") or donk.get("Name") or None if donk_text: lines.append(donk_text) lines.append("")