summaryrefslogtreecommitdiff
path: root/server/src/net
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2022-01-02 22:18:57 +0000
committerJuan J. Martinez <jjm@usebox.net>2022-01-02 22:24:48 +0000
commit21f8ae5db73be083340bb65b4e1ab7ec3abb41b7 (patch)
treeb3421907d2133b06d0800a1c6dc0c6a47abff64d /server/src/net
parentb5b419ad0a89b36e136f4509a59a145f991e833d (diff)
downloadspacebeans-21f8ae5db73be083340bb65b4e1ab7ec3abb41b7.tar.gz
spacebeans-21f8ae5db73be083340bb65b4e1ab7ec3abb41b7.zip
Resolve CGI directories from more to less specific
Closes issue #2.
Diffstat (limited to 'server/src/net')
-rw-r--r--server/src/net/usebox/gemini/server/ServiceConf.scala6
1 files changed, 5 insertions, 1 deletions
diff --git a/server/src/net/usebox/gemini/server/ServiceConf.scala b/server/src/net/usebox/gemini/server/ServiceConf.scala
index 43786af..ec082cf 100644
--- a/server/src/net/usebox/gemini/server/ServiceConf.scala
+++ b/server/src/net/usebox/gemini/server/ServiceConf.scala
@@ -44,10 +44,14 @@ object VirtualHost {
def getCgi(path: Path): Option[Path] =
vhost.directories
+ .filter(_.allowCgi == Some(true))
+ .sortWith {
+ case (d1, d2) => d1.path.length() > d2.path.length()
+ }
.find(d =>
path.startsWith(
d.path
- ) && path.toString != d.path && d.allowCgi == Some(true)
+ ) && path.toString != d.path
)
.collect {
case d =>