Commit 11db21d96b3ddd1c4afa842650ff0a8833220686

Thomas de Grivel 2018-06-15T11:17:54

only serve regular files

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/thot.lisp b/thot.lisp
index b3b6db0..bebb42c 100644
--- a/thot.lisp
+++ b/thot.lisp
@@ -389,10 +389,12 @@ The requested url "
       t)))
 
 (defun probe-file (path)
-  (let ((filep (fcntl:c-open/2 path fcntl:+o-rdonly+)))
-    (unless (< filep 0)
-      (unistd:close filep)
-      t)))
+  (when (with-stat (stat) path
+                   (s-isreg (the fixnum (stat-mode stat))))
+    (let ((filep (the fixnum (fcntl:c-open/2 path fcntl:+o-rdonly+))))
+      (unless (< filep 0)
+        (unistd:close filep)
+        t))))
 
 (defun prefix-p (pre str)
   (declare (type simple-string pre str))