]> Untitled Git - public.git/blobdiff - lua/publish.lua
Hotfix 1.3.1
[public.git] / lua / publish.lua
index c0a4ff79347da9cb1fe0a92999a0dd9c63a27a81..f5620183cfdd906030a0bba48d321c6d40f654f0 100644 (file)
@@ -1,7 +1,7 @@
 require "apache2"
 
 function publish(dir, pattern)
-    local cmd = ("%s/publish.sh %s"):format(dir, pattern)
+    local cmd = ("%s/publish.sh '%s'"):format(dir, pattern)
     local handle = io.popen(cmd)
     local output = handle:read('*a')
     handle:close()
@@ -21,9 +21,12 @@ function handle(r)
     r.content_type = "text/html"
 
     local args = r:parseargs()
-    local pattern = args.pattern 
+    local pattern = args.pattern
 
     if pattern then
+        -- filename might have spaces that apache replaces with '+'
+        pattern = string.gsub(pattern, '+', ' ')
+
         local nonce = publish(r.context_document_root, pattern)
         if nonce == "" then
             r:puts( "No links created" )