ponymail-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject incubator-ponymail git commit: lua scripts not using cross.contentType() compatibility function
Date Sat, 17 Dec 2016 01:19:37 GMT
Repository: incubator-ponymail
Updated Branches:
  refs/heads/master 70eb2633f -> 48b06fe04


lua scripts not using cross.contentType() compatibility function

This fixes #218

Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/48b06fe0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/48b06fe0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/48b06fe0

Branch: refs/heads/master
Commit: 48b06fe04de55b551d84593bbdee982e29322d39
Parents: 70eb263
Author: Sebb <sebb@apache.org>
Authored: Sat Dec 17 01:19:19 2016 +0000
Committer: Sebb <sebb@apache.org>
Committed: Sat Dec 17 01:19:19 2016 +0000

----------------------------------------------------------------------
 CHANGELOG.md               | 1 +
 site/api/compose.lua       | 2 +-
 site/api/email.lua         | 4 ++--
 site/api/mbox.lua          | 6 +++---
 site/api/notifications.lua | 2 +-
 site/api/oauth.lua         | 2 +-
 site/api/pminfo.lua        | 2 +-
 site/api/preferences.lua   | 4 ++--
 site/api/source.lua        | 2 +-
 site/api/thread.lua        | 2 +-
 site/api/websearch.lua     | 2 +-
 11 files changed, 15 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/CHANGELOG.md
----------------------------------------------------------------------
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 42432d3..b16232a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -72,6 +72,7 @@
 - stats.lua - inconsistent output between slow_count = true/false (#301)
 - confusion of storageAvailable and localStorage in ponymail.js (#194)
 - unnecessary double-checking of window.sessionStorage in ponymail.js (#193)
+- lua scripts not using cross.contentType() compatibility function (#218)
 
 ## CHANGES in 0.9b:
 

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/compose.lua
----------------------------------------------------------------------
diff --git a/site/api/compose.lua b/site/api/compose.lua
index cc051e6..744eb19 100644
--- a/site/api/compose.lua
+++ b/site/api/compose.lua
@@ -27,7 +27,7 @@ local cross = require 'lib/cross'
 
 function handle(r)
     local account = user.get(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     
     -- make sure the user is logged in
     if account and account.cid then

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/email.lua
----------------------------------------------------------------------
diff --git a/site/api/email.lua b/site/api/email.lua
index 4c62437..d5921f1 100644
--- a/site/api/email.lua
+++ b/site/api/email.lua
@@ -40,7 +40,7 @@ local function anonymize(doc)
 end
 
 function handle(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local get = r:parseargs()
     local eid = (get.id or ""):gsub("\"", "")
     local _, doc = pcall(function() return elastic.get("mbox", eid or "hmm") end)
@@ -87,7 +87,7 @@ function handle(r)
                             break
                         end
                     end
-                    r.content_type = ct
+                    cross.contentType(r, ct)
                     r.headers_out['Content-Length'] = fs
                     if not (ct:match("image") or ct:match("text")) then
                         r.headers_out['Content-Disposition'] = ("attachment; filename=\"%s\";"):format(fn)

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/mbox.lua
----------------------------------------------------------------------
diff --git a/site/api/mbox.lua b/site/api/mbox.lua
index 0c9aca4..de769be 100644
--- a/site/api/mbox.lua
+++ b/site/api/mbox.lua
@@ -64,14 +64,14 @@ local function getFromLine(r, source)
 end
 
 function handle(r)
-    r.content_type = "application/mbox"
+    cross.contentType(r, "application/mbox")
     local get = r:parseargs()
     if get.list and get.date then
         local lid = ("<%s>"):format(get.list:gsub("@", "."):gsub("[<>]", ""))
         local flid = get.list:gsub("[.@]", "_")
         local month = get.date:match("(%d+%-%d+)")
         if not month then
-            r.content_type = "text/plain"
+            cross.contentType(r, "text/plain")
             r:puts("Wrong date format given!\n")
             return cross.OK
         end
@@ -148,7 +148,7 @@ function handle(r)
             end
         end
     else
-        r.content_type = "text/plain"
+        cross.contentType(r, "text/plain")
         r:puts("Both list and date are required!\n")
     end
     return cross.OK

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/notifications.lua
----------------------------------------------------------------------
diff --git a/site/api/notifications.lua b/site/api/notifications.lua
index 1cdb693..a7a5bf7 100644
--- a/site/api/notifications.lua
+++ b/site/api/notifications.lua
@@ -26,7 +26,7 @@ local cross = require 'lib/cross'
 local utils = require 'lib/utils'
 
 function handle(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local now = r:clock()
     local get = r:parseargs()
     

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/oauth.lua
----------------------------------------------------------------------
diff --git a/site/api/oauth.lua b/site/api/oauth.lua
index 1e0170c..4167e89 100644
--- a/site/api/oauth.lua
+++ b/site/api/oauth.lua
@@ -26,7 +26,7 @@ local cross = require 'lib/cross'
 local config = require 'lib/config'
 
 function handle(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local get = r:parseargs()
     local post = r:parsebody()
     local valid, json

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/pminfo.lua
----------------------------------------------------------------------
diff --git a/site/api/pminfo.lua b/site/api/pminfo.lua
index 0d97cac..bb99b04 100644
--- a/site/api/pminfo.lua
+++ b/site/api/pminfo.lua
@@ -22,7 +22,7 @@ local elastic = require 'lib/elastic'
 local cross = require 'lib/cross'
 
 function handle(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local t = {}
     local now = r:clock()
     local tnow = now

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/preferences.lua
----------------------------------------------------------------------
diff --git a/site/api/preferences.lua b/site/api/preferences.lua
index d5be503..7d97640 100644
--- a/site/api/preferences.lua
+++ b/site/api/preferences.lua
@@ -40,7 +40,7 @@ Parameters: (cookie required)
 ]]--
 function handle(r)
     local now = r:clock()
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local now = r:clock()
     local get = r:parseargs()
     
@@ -133,7 +133,7 @@ Pony Mail - Email for Ponies and People.
             end
         end
         user.save(r, account, true)
-        r.content_type = "text/plain"
+        cross.contentType(r, "text/plain")
         if verified then
             r:puts("Email address verified! Thanks for shopping at Pony Mail!\n")
         else

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/source.lua
----------------------------------------------------------------------
diff --git a/site/api/source.lua b/site/api/source.lua
index 892723b..ee544fd 100644
--- a/site/api/source.lua
+++ b/site/api/source.lua
@@ -24,7 +24,7 @@ local cross = require 'lib/cross'
 local utils = require 'lib/utils'
 
 function handle(r)
-    r.content_type = "text/plain"
+    cross.contentType(r, "text/plain")
     local get = r:parseargs()
     local eid = (get.id or r.path_info):gsub("\"", ""):gsub("/", "")
     local doc = elastic.get("mbox", eid or "hmm")

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/thread.lua
----------------------------------------------------------------------
diff --git a/site/api/thread.lua b/site/api/thread.lua
index 04bde9f..e485ed1 100644
--- a/site/api/thread.lua
+++ b/site/api/thread.lua
@@ -83,7 +83,7 @@ local function fetchChildren(r, pdoc, c, biglist, account)
 end
 
 function handle(r)
-    r.content_type = "application/json"
+    cross.contentType(r, "application/json")
     local now = r:clock()
     local get = r:parseargs()
     local eid = (get.id or ""):gsub("\"", "")

http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48b06fe0/site/api/websearch.lua
----------------------------------------------------------------------
diff --git a/site/api/websearch.lua b/site/api/websearch.lua
index c1355a8..62e92d9 100644
--- a/site/api/websearch.lua
+++ b/site/api/websearch.lua
@@ -25,7 +25,7 @@ function handle(r)
         scheme = "http"
     end
     local hostname = ("%s://%s:%u"):format(scheme, r.hostname, r.port)
-    r.content_type = 'application/opensearchdescription+xml'
+    cross.contentType(r, 'application/opensearchdescription+xml')
     r:puts(([[<?xml version="1.0" encoding="UTF-8"?>
 <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
   <ShortName>Pony Mail: %s</ShortName>


Mime
View raw message