mirror of
https://codeberg.org/cage/tinmop/
synced 2025-02-01 04:26:47 +01:00
- fixed 'uri:normalize-path';
- [gemini] cleaned paths when exploring local tree.
This commit is contained in:
parent
e2a9016607
commit
ef3724e986
@ -1017,8 +1017,9 @@
|
||||
((gemini-client:absolute-gemini-url-p url)
|
||||
(gemini-viewer:request url :use-cached-file-if-exists use-cached-file-if-exists))
|
||||
((fs:dirp url)
|
||||
(let* ((index-path (fs:prepend-pwd url))
|
||||
(all-paths (fs:collect-children index-path))
|
||||
(let* ((index-path (uri:normalize-path (fs:prepend-pwd url)))
|
||||
(all-paths (mapcar #'uri:normalize-path
|
||||
(fs:collect-children index-path)))
|
||||
(raw-text (with-output-to-string (stream)
|
||||
(write-sequence (gemini-parser:geminize-h1
|
||||
(format nil
|
||||
|
@ -75,5 +75,6 @@
|
||||
(deftest test-normalize-path (uri-suite)
|
||||
(assert-true (normalize "/a/x" "/a/x"))
|
||||
(assert-true (normalize "/a/../b/x" "/b/x"))
|
||||
(assert-true (normalize "/a/../b/x/.." "/b/x/"))
|
||||
(assert-true (normalize "/a/../b/x/." "/b/x/")))
|
||||
(assert-true (normalize "/a/../b/x/.." "/b/"))
|
||||
(assert-true (normalize "/a/../b/x/." "/b/x/"))
|
||||
(assert-true (normalize "/a/b/c/./../../g" "/a/g")))
|
||||
|
@ -349,13 +349,15 @@
|
||||
(let ((popped (stack:stack-pop input-stack)))
|
||||
(cond
|
||||
((and (string= popped "..")
|
||||
(not (stack:stack-empty-p output-stack))
|
||||
(not (stack:stack-empty-p input-stack)))
|
||||
(stack:stack-pop output-stack))
|
||||
(not (stack:stack-empty-p output-stack)))
|
||||
(stack:stack-pop output-stack)
|
||||
(when (stack:stack-empty-p input-stack)
|
||||
(setf ends-with-dots t)))
|
||||
((and (or (string= popped "..")
|
||||
(string= popped "."))
|
||||
(stack:stack-empty-p input-stack))
|
||||
(setf ends-with-dots t))
|
||||
(setf ends-with-dots t)
|
||||
(stack:stack-push output-stack "/"))
|
||||
((and (string/= popped ".")
|
||||
(string/= popped ".."))
|
||||
(stack:stack-push output-stack popped))))
|
||||
|
Loading…
x
Reference in New Issue
Block a user