mirror of https://codeberg.org/cage/tinmop/
- taken into account the query of the original URI when combining it with a path.
This commit is contained in:
parent
6e883ca21b
commit
008d5001a7
|
@ -313,10 +313,11 @@
|
|||
(port port)
|
||||
(path path)
|
||||
(meta meta)
|
||||
(query query)
|
||||
(status-code status-code)
|
||||
(status-code-description status-code-description)) stream-object
|
||||
(let* ((parsed (gemini-parser:parse-gemini-file src-data))
|
||||
(links (gemini-parser:sexp->links parsed host port path))
|
||||
(links (gemini-parser:sexp->links parsed host port path query))
|
||||
(response (gemini-client:make-gemini-file-response status-code
|
||||
status-code-description
|
||||
meta
|
||||
|
|
|
@ -260,18 +260,29 @@
|
|||
path
|
||||
(fs:parent-dir-path path)))
|
||||
|
||||
(defun absolutize-link (link-value original-host original-port original-path)
|
||||
(defun absolutize-link (link-value original-host original-port original-path original-query)
|
||||
(let ((parsed (or (ignore-errors (iri:iri-parse link-value))
|
||||
(iri:make-iri nil nil nil nil link-value nil nil))))
|
||||
(cond
|
||||
((null (uri:host parsed))
|
||||
(let* ((absolute-path-p (string-starts-with-p "/" link-value))
|
||||
(path (if absolute-path-p
|
||||
(uri:path parsed)
|
||||
(query-path-p (uri:query parsed))
|
||||
(path (cond
|
||||
(absolute-path-p
|
||||
(uri:path parsed))
|
||||
((and query-path-p
|
||||
original-query)
|
||||
(strcat (safe-all-but-last-elt original-path)
|
||||
(uri:path parsed)))
|
||||
((or query-path-p
|
||||
original-query)
|
||||
(strcat original-path
|
||||
(uri:path parsed)))
|
||||
(t
|
||||
(strcat (if original-path
|
||||
(path-last-dir original-path)
|
||||
"/")
|
||||
(uri:path parsed)))))
|
||||
(uri:path parsed))))))
|
||||
(make-gemini-iri original-host
|
||||
(fs:normalize-path path)
|
||||
:query (uri:query parsed)
|
||||
|
@ -325,7 +336,7 @@
|
|||
(setf iri (strcat iri "#" fragment)))
|
||||
iri))
|
||||
|
||||
(defun sexp->links (parsed-gemini original-host original-port original-path
|
||||
(defun sexp->links (parsed-gemini original-host original-port original-path original-query
|
||||
&key (comes-from-local-file nil))
|
||||
(loop
|
||||
for node in parsed-gemini
|
||||
|
@ -344,7 +355,8 @@
|
|||
(absolutize-link link-value
|
||||
original-host
|
||||
original-port
|
||||
original-path)))))
|
||||
original-path
|
||||
original-query)))))
|
||||
(make-instance 'gemini-link
|
||||
:target rendered-link
|
||||
:name (tag-value node)))))
|
||||
|
|
|
@ -75,7 +75,8 @@ be subscribed before (see: 'gemini-subscription:subcribe'"
|
|||
(sexp->links parsed
|
||||
(uri:host gemlog-iri)
|
||||
(uri:port gemlog-iri)
|
||||
(uri:path gemlog-iri)))))
|
||||
(uri:path gemlog-iri)
|
||||
(uri:query gemlog-iri)))))
|
||||
(loop for link in links do
|
||||
(when (not (db:find-gemlog-entry (to-s (target link))))
|
||||
(let ((date (link-post-timestamp (name link))))
|
||||
|
|
|
@ -1100,6 +1100,7 @@
|
|||
nil
|
||||
nil
|
||||
local-path
|
||||
nil
|
||||
:comes-from-local-file local-path-p))
|
||||
(ir-text (gemini-parser:sexp->text-rows parsed
|
||||
gemini-client:*gemini-page-theme*)))
|
||||
|
@ -1207,6 +1208,7 @@
|
|||
nil
|
||||
nil
|
||||
parent-dir
|
||||
nil
|
||||
:comes-from-local-file t))
|
||||
(local-links (remove-if (lambda (link)
|
||||
(let ((target (gemini-parser:target link)))
|
||||
|
@ -1405,7 +1407,8 @@
|
|||
(links (gemini-parser:sexp->links parsed
|
||||
(uri:host url)
|
||||
(uri:port url)
|
||||
(uri:path url)))
|
||||
(uri:path url)
|
||||
(uri:query url)))
|
||||
(theme gemini-client:*gemini-page-theme*))
|
||||
(gemini-viewer:maybe-initialize-metadata specials:*message-window*)
|
||||
(refresh-gemini-message-window links
|
||||
|
|
|
@ -1413,7 +1413,8 @@ Browse and optionally open the links the text of the message window contains."
|
|||
(gemini-parser:absolutize-link uri
|
||||
(uri:host current-url)
|
||||
(uri:port current-url)
|
||||
(uri:path current-url)))))
|
||||
(uri:path current-url)
|
||||
(uri:query current-url)))))
|
||||
(open-message-link-window:open-message-link absolute-uri nil)))))
|
||||
|
||||
(defun open-previous-link ()
|
||||
|
|
Loading…
Reference in New Issue