branch: elpa/hyperdrive
commit 24064d9de677b8b2f0ae1abc9db78195257250c8
Author: Joseph Turner <[email protected]>
Commit: Joseph Turner <[email protected]>

    Fix: Don't remove "::" from non-Org link targets
---
 hyperdrive-lib.el | 9 ++++++---
 hyperdrive-org.el | 4 ++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index 2f540dbc89..a0ea414b5e 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -281,8 +281,10 @@ before making the entry struct."
                       (or (gethash host h/hyperdrives)
                           (h/create :public-key host)))))
        (etc (and target
-                 `((target . ,(substring (url-unhex-string target)
-                                         (length "::"))))))
+                 `((target . ,(if (h/org-filename-p path)
+                                  (substring (url-unhex-string target)
+                                             (length "::"))
+                                (url-unhex-string target))))))
        (version (pcase path
                   ((rx "/$/version/" (let v (1+ num)) (let p (0+ anything)))
                    (setf path p)
@@ -980,7 +982,8 @@ Path and target fragment are URI-encoded."
                (target-part (and with-target
                                  target
                                  (concat "#"
-                                         (url-hexify-string "::")
+                                         (when (h/org-filename-p path)
+                                           (url-hexify-string "::"))
                                          (url-hexify-string target))))
                (path (and with-path
                           ;; TODO: Consider removing this argument if it's not 
needed.
diff --git a/hyperdrive-org.el b/hyperdrive-org.el
index 3ca0327387..844291afe8 100644
--- a/hyperdrive-org.el
+++ b/hyperdrive-org.el
@@ -227,6 +227,10 @@ Respects `hyperdrive-org-link-full-url' and 
`org-link-file-path-type'."
     ;; after `hyperdrive' is loaded so that `hyperdrive-mode' will be defined.
     (cl-pushnew #'hyperdrive-org--open-at-point org-open-at-point-functions)))
 
+(defun h/org-filename-p (path)
+  "Return non-nil when PATH is an Org file."
+  (string-suffix-p ".org" path))
+
 ;;;; Footer
 
 (provide 'hyperdrive-org)

Reply via email to