From 21f8ae5db73be083340bb65b4e1ab7ec3abb41b7 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sun, 2 Jan 2022 22:18:57 +0000 Subject: Resolve CGI directories from more to less specific Closes issue #2. --- server/src/net/usebox/gemini/server/ServiceConf.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'server/src/net') 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 => -- cgit v1.2.3