Make sure that ‘tekuti-host’ doesn't end in a ‘/’

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"))'.
This commit is contained in:
Tom Willemse 2023-12-07 22:04:24 -08:00
parent 0f663fabc6
commit 8bd0ba25e4

View file

@ -43,7 +43,11 @@
(require 'org) (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) (defun tekuti--format-date (&optional date)
"Format DATE into a date that tekuti understands." "Format DATE into a date that tekuti understands."
@ -136,7 +140,7 @@
(url-request-data (tekuti-form-encode-data data)) (url-request-data (tekuti-form-encode-data data))
(previous-update-url (tekuti--get-update-url)) (previous-update-url (tekuti--get-update-url))
(updatep (not (null previous-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 (or previous-update-url
"/admin/new-post")) "/admin/new-post"))
#'tekuti--send-finished #'tekuti--send-finished