Quellcode durchsuchen

[back] Fix '[' handling in paths

Innokentiy Enikeev vor 4 Jahren
Ursprung
Commit
a3eebc245a
1 geänderte Dateien mit 8 neuen und 7 gelöschten Zeilen
  1. 8 7
      back/server.lisp

+ 8 - 7
back/server.lisp

@@ -9,14 +9,15 @@
 (defun get-url (path)
   (declare #.*standard-optimize-settings*)
   (when (and path (pathnamep path))
-    (let ((path (namestring path)))
+    (let ((path (uiop:unix-namestring path)))
       (loop for (path-prefix . url-prefix) in *path-url-mappings*
-         do (multiple-value-bind (foundp suffix) (starts-with-subseq path-prefix path :return-suffix t)
-              (when foundp
-                (return-from get-url (concatenate 'string url-prefix
-                                                  (format nil "~{~A~^/~}"
-                                                          (mapcar #'quri:url-encode
-                                                                  (split-sequence:split-sequence #\/ suffix)))))))))))
+            do (multiple-value-bind (foundp suffix)
+		   (starts-with-subseq path-prefix path :return-suffix t)
+		 (when foundp
+                   (return-from get-url (concatenate 'string url-prefix
+                                                     (format nil "~{~A~^/~}"
+                                                             (mapcar #'quri:url-encode
+                                                                     (split-sequence:split-sequence #\/ suffix)))))))))))
 
 (defmacro maybe-key-value (key value)
   `(when ,value