]> Untitled Git - public.git/blobdiff - lua/publish.lua
Added prod compose file
[public.git] / lua / publish.lua
index b98e8f4a344daea49f14e5f8f8df9d7672e12e16..c0a4ff79347da9cb1fe0a92999a0dd9c63a27a81 100644 (file)
@@ -25,14 +25,19 @@ function handle(r)
 
     if pattern then
         local nonce = publish(r.context_document_root, pattern)
-
-        -- if FQDN override is set,
-        -- use override instead of my own server name and port number
-        local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
-        fqdn = fqdn or (r.is_https and "https" or "http") .. "://" .. r.server_name .. ":" ..r.port
-
-        local uri = ("%s/%s/"):format(fqdn, nonce)
-        r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+        if nonce == "" then
+            r:puts( "No links created" )
+        else
+            -- if FQDN override is set,
+            -- use override instead of my own server name and port number
+            local fqdn = os.getenv('PUBLIC_FQDN_OVERRIDE')
+            fqdn = fqdn or
+                (r.is_https and "https" or "http") ..
+                "://" .. r.server_name .. ":" ..r.port
+
+            local uri = ("%s/%s/"):format(fqdn, nonce)
+            r:puts( ([[<a href="%s">%s</a>]]):format(uri, uri) )
+        end
     else
         local template = get_form(r.context_document_root)
         r:puts( template )