From 8bd0ba25e46f0398c30b2e84c26dc7913c52b35f Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 7 Dec 2023 22:04:24 -0800 Subject: [PATCH] =?UTF-8?q?Make=20sure=20that=20=E2=80=98tekuti-host?= =?UTF-8?q?=E2=80=99=20doesn't=20end=20in=20a=20=E2=80=98/=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tekuti gets real confused when a request is sent to https://tekuti.example.com//admin/new-post claiming that the host field is missing. From my logs: Throw to key `uri-error' with args `("Expected path not starting with \"//\" (no host): ~a" ("//admin/new-post"))'. --- tekuti.el | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tekuti.el b/tekuti.el index bbd4e56..c859396 100644 --- a/tekuti.el +++ b/tekuti.el @@ -43,7 +43,11 @@ (require 'org) -(defvar tekuti-host "http://127.0.0.1:8080") +(defvar tekuti-host "http://127.0.0.1:8080" + "The host where tekuti is running. +This should be the base URL of your blog. Where adding ‘/admin’ +will get you into the admin area of your blog. This shouldn't end +with a ‘/’.") (defun tekuti--format-date (&optional date) "Format DATE into a date that tekuti understands." @@ -136,7 +140,7 @@ (url-request-data (tekuti-form-encode-data data)) (previous-update-url (tekuti--get-update-url)) (updatep (not (null previous-update-url)))) - (url-retrieve (format "%s%s" tekuti-host + (url-retrieve (format "%s%s" (string-trim-right tekuti-host "/") (or previous-update-url "/admin/new-post")) #'tekuti--send-finished