Forráskód Böngészése

Fix content-disposition for download

nagadomi 9 éve
szülő
commit
b5903b3d56
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      web.lua

+ 3 - 1
web.lua

@@ -229,12 +229,14 @@ function APIHandler:post()
       end
       end
       local name = uuid() .. ".png"
       local name = uuid() .. ".png"
       local blob = image_loader.encode_png(alpha_util.composite(x, alpha))
       local blob = image_loader.encode_png(alpha_util.composite(x, alpha))
-      self:set_header("Content-Disposition", string.format('filename="%s"', name))
+
       self:set_header("Content-Length", string.format("%d", #blob))
       self:set_header("Content-Length", string.format("%d", #blob))
       if download > 0 then
       if download > 0 then
 	 self:set_header("Content-Type", "application/octet-stream")
 	 self:set_header("Content-Type", "application/octet-stream")
+	 self:set_header("Content-Disposition", string.format('attachment; filename="%s"', name))
       else
       else
 	 self:set_header("Content-Type", "image/png")
 	 self:set_header("Content-Type", "image/png")
+	 self:set_header("Content-Disposition", string.format('inline; filename="%s"', name))
       end
       end
       self:write(blob)
       self:write(blob)
    else
    else