From 4796bc48d4083ccab4be79075b15ea70acdc2fa0 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Wed, 19 Jun 2019 22:16:19 +0200 Subject: [PATCH] Fixed bug in non-gopher URL construction. --- elpher.el | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/elpher.el b/elpher.el index 210824a..d1d795c 100644 --- a/elpher.el +++ b/elpher.el @@ -4,7 +4,7 @@ ;; Author: Tim Vaughan ;; Created: 11 April 2019 -;; Version: 1.2.3 +;; Version: 1.2.4 ;; Keywords: comm gopher ;; Homepage: https://github.com/tgvaughan/elpher ;; Package-Requires: ((emacs "25")) @@ -57,7 +57,7 @@ ;;; Global constants ;; -(defconst elpher-version "1.2.3" +(defconst elpher-version "1.2.4" "Current version of elpher.") (defconst elpher-margin-width 6 @@ -1013,14 +1013,20 @@ host, selector and port." (defun elpher-get-address-url (address) "Get URL representation of ADDRESS." - (concat "gopher://" - (elpher-address-host address) - (let ((port (elpher-address-port address))) - (if (equal port 70) - "" - (format ":%d" port))) - "/" (string (elpher-address-type address)) - (elpher-address-selector address))) + (let ((type (elpher-address-type address)) + (selector (elpher-address-selector address)) + (host (elpher-address-host address)) + (port (elpher-address-port address))) + (if (and (equal type ?h) + (string-prefix-p "URL:" selector)) + (elt (split-string selector "URL:") 1) + (concat "gopher://" + host + (if (equal port 70) + "" + (format ":%d" port)) + "/" (string type) + selector)))) (defun elpher-copy-node-url (node) "Copy URL representation of address of NODE to `kill-ring'." -- 2.20.1