You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by se...@apache.org on 2016/11/09 23:22:10 UTC
incubator-ponymail git commit: search strings not properly quoted
Repository: incubator-ponymail
Updated Branches:
refs/heads/master c0bb4ebcd -> 48a459955
search strings not properly quoted
This fixes #76
Replace deprecated escape() method with encodeURIComponent
Project: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/commit/48a45995
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/tree/48a45995
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ponymail/diff/48a45995
Branch: refs/heads/master
Commit: 48a459955f1abfe05d6cb679c3890e66788f8e82
Parents: c0bb4eb
Author: Sebb <se...@apache.org>
Authored: Wed Nov 9 23:22:05 2016 +0000
Committer: Sebb <se...@apache.org>
Committed: Wed Nov 9 23:22:05 2016 +0000
----------------------------------------------------------------------
site/js/dev/ponymail_composer.js | 4 ++--
site/js/dev/ponymail_ngrams.js | 4 ++--
site/js/dev/ponymail_search.js | 14 +++++++-------
site/js/dev/ponymail_trends.js | 4 ++--
site/js/ponymail.js | 26 +++++++++++++-------------
5 files changed, 26 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48a45995/site/js/dev/ponymail_composer.js
----------------------------------------------------------------------
diff --git a/site/js/dev/ponymail_composer.js b/site/js/dev/ponymail_composer.js
index c45f58c..6b98b82 100644
--- a/site/js/dev/ponymail_composer.js
+++ b/site/js/dev/ponymail_composer.js
@@ -235,7 +235,7 @@ function compose(eid, lid, type) {
truncated = true
eml_raw_short = eml_raw_short.substring(0, N) + "\n[message truncated...]"
}
- var xlink = 'mailto:' + listname + "?subject=" + escape(subject) + "&In-Reply-To=" + escape(email['message-id']) + "&body=" + escape(eml_raw_short)
+ var xlink = 'mailto:' + listname + "?subject=" + encodeURIComponent(subject) + "&In-Reply-To=" + encodeURIComponent(email['message-id']) + "&body=" + encodeURIComponent(eml_raw_short)
// Make a button object
var btn = document.createElement('input')
@@ -269,7 +269,7 @@ function compose(eid, lid, type) {
eml_raw_short = eml_raw_short.substring(0, N) + "\n[message truncated...]"
}
var subject = "Re: " + email.subject.replace(/^Re:\s*/mg, "").replace(/</mg, "<")
- var link = 'mailto:' + email.list.replace(/[<>]/g, "").replace(/([^.]+)\./, "$1@") + "?subject=" + escape(subject) + "&In-Reply-To=" + escape(email['message-id']) + "&body=" + escape(eml_raw_short)
+ var link = 'mailto:' + email.list.replace(/[<>]/g, "").replace(/([^.]+)\./, "$1@") + "?subject=" + encodeURIComponent(subject) + "&In-Reply-To=" + encodeURIComponent(email['message-id']) + "&body=" + encodeURIComponent(eml_raw_short)
// Get compose pane, show it
var obj = document.getElementById('splash')
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48a45995/site/js/dev/ponymail_ngrams.js
----------------------------------------------------------------------
diff --git a/site/js/dev/ponymail_ngrams.js b/site/js/dev/ponymail_ngrams.js
index 6c7d3c1..3ad5c77 100644
--- a/site/js/dev/ponymail_ngrams.js
+++ b/site/js/dev/ponymail_ngrams.js
@@ -203,7 +203,7 @@ function loadNgrams() {
var plaw = false
for (var n in queries) {
var nquery = []
- var q = escape(queries[n])
+ var q = encodeURIComponent(queries[n])
if (q == 'avg') {
avg = true
continue
@@ -231,7 +231,7 @@ function loadNgrams() {
if (m) {
q = q.replace(m[0], "")
// append to the header_foo query
- nquery.push("header_" + stuff[k] + "=" + m[1].replace(/([\s&+=])/g, function(a) { return escape(a)}))
+ nquery.push("header_" + stuff[k] + "=" + encodeURIComponent(m[1]))
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48a45995/site/js/dev/ponymail_search.js
----------------------------------------------------------------------
diff --git a/site/js/dev/ponymail_search.js b/site/js/dev/ponymail_search.js
index 5b5f9aa..66df366 100644
--- a/site/js/dev/ponymail_search.js
+++ b/site/js/dev/ponymail_search.js
@@ -101,10 +101,10 @@ function search(q, d, nopush, all) {
clearCalendarHover()
// As usual, push new history state
- if (!nopush) window.history.pushState({}, "", "list.html?" + listname + "@" + domain + ":" + d + ":" + escape(q));
+ if (!nopush) window.history.pushState({}, "", "list.html?" + listname + "@" + domain + ":" + d + ":" + encodeURIComponent(q));
// get the data from backend, push to page builder func
- GetAsync("/api/stats.lua?list=" + listname + "&domain=" + domain + "&q=" + q.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "&d=" + d, null, buildPage)
+ GetAsync("/api/stats.lua?list=" + listname + "&domain=" + domain + "&q=" + encodeURIComponent(q) + "&d=" + d, null, buildPage)
// for the list title, prepare the date range
// TODO: improve this much like we have with trends.html
@@ -132,14 +132,14 @@ function searchAll(q, dspan, from, subject, where) {
wherel = a[0]
whered = a[1]
}
- var url = "/api/stats.lua?list="+wherel+"&domain="+whered+"&q=" + q.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "&d=" + escape(dspan)
+ var url = "/api/stats.lua?list="+wherel+"&domain="+whered+"&q=" + encodeURIComponent(q) + "&d=" + encodeURIComponent(dspan)
if (from) {
- url += "&header_from=" + "\""+ from.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
- current_query += " FROM:" + "\""+ from.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
+ url += "&header_from=" + "\""+ encodeURIComponent(from) + "\""
+ current_query += " FROM:" + "\""+ encodeURIComponent(from) + "\""
}
if (subject) {
- url += "&header_subject=\"" + subject.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
- current_query += " SUBJECT:\"" + subject.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
+ url += "&header_subject=\"" + encodeURIComponent(subject) + "\""
+ current_query += " SUBJECT:\"" + encodeURIComponent(subject) + "\""
}
GetAsync(url, {
deep: true
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48a45995/site/js/dev/ponymail_trends.js
----------------------------------------------------------------------
diff --git a/site/js/dev/ponymail_trends.js b/site/js/dev/ponymail_trends.js
index 5a9c1b5..7f134d9 100644
--- a/site/js/dev/ponymail_trends.js
+++ b/site/js/dev/ponymail_trends.js
@@ -299,7 +299,7 @@ function gatherTrends() {
if (m) {
query = query.replace(m[0], "")
// append to the header_foo query
- nquery += "&header_" + stuff[k] + "=" + escape(m[1])
+ nquery += "&header_" + stuff[k] + "=" + encodeURIComponent(m[1])
}
}
}
@@ -321,6 +321,6 @@ function gatherTrends() {
var domain = arr[1]
// Get us some data
- GetAsync('/api/stats.lua?list='+listname+'&domain='+domain+'&d=' + xa[0] + "&q=" + ((query && query.length > 0) ? escape(query) : "") + nquery, { nquery: nquery, listname: listname, domain: domain, dbl: xa[0], dfrom: xa[1], dto: xa[2], tspan: xa[3], dspan: dspan, query: query }, showTrends)
+ GetAsync('/api/stats.lua?list='+listname+'&domain='+domain+'&d=' + xa[0] + "&q=" + ((query && query.length > 0) ? encodeURIComponent(query) : "") + nquery, { nquery: nquery, listname: listname, domain: domain, dbl: xa[0], dfrom: xa[1], dto: xa[2], tspan: xa[3], dspan: dspan, query: query }, showTrends)
document.title = "Stats for " + list + " - Pony Mail!"
}
http://git-wip-us.apache.org/repos/asf/incubator-ponymail/blob/48a45995/site/js/ponymail.js
----------------------------------------------------------------------
diff --git a/site/js/ponymail.js b/site/js/ponymail.js
index 4b82051..ec72853 100644
--- a/site/js/ponymail.js
+++ b/site/js/ponymail.js
@@ -322,7 +322,7 @@ function compose(eid, lid, type) {
truncated = true
eml_raw_short = eml_raw_short.substring(0, N) + "\n[message truncated...]"
}
- var xlink = 'mailto:' + listname + "?subject=" + escape(subject) + "&In-Reply-To=" + escape(email['message-id']) + "&body=" + escape(eml_raw_short)
+ var xlink = 'mailto:' + listname + "?subject=" + encodeURIComponent(subject) + "&In-Reply-To=" + encodeURIComponent(email['message-id']) + "&body=" + encodeURIComponent(eml_raw_short)
// Make a button object
var btn = document.createElement('input')
@@ -356,7 +356,7 @@ function compose(eid, lid, type) {
eml_raw_short = eml_raw_short.substring(0, N) + "\n[message truncated...]"
}
var subject = "Re: " + email.subject.replace(/^Re:\s*/mg, "").replace(/</mg, "<")
- var link = 'mailto:' + email.list.replace(/[<>]/g, "").replace(/([^.]+)\./, "$1@") + "?subject=" + escape(subject) + "&In-Reply-To=" + escape(email['message-id']) + "&body=" + escape(eml_raw_short)
+ var link = 'mailto:' + email.list.replace(/[<>]/g, "").replace(/([^.]+)\./, "$1@") + "?subject=" + encodeURIComponent(subject) + "&In-Reply-To=" + encodeURIComponent(email['message-id']) + "&body=" + encodeURIComponent(eml_raw_short)
// Get compose pane, show it
var obj = document.getElementById('splash')
@@ -3541,7 +3541,7 @@ function loadNgrams() {
var plaw = false
for (var n in queries) {
var nquery = []
- var q = escape(queries[n])
+ var q = encodeURIComponent(queries[n])
if (q == 'avg') {
avg = true
continue
@@ -3569,7 +3569,7 @@ function loadNgrams() {
if (m) {
q = q.replace(m[0], "")
// append to the header_foo query
- nquery.push("header_" + stuff[k] + "=" + m[1].replace(/([\s&+=])/g, function(a) { return escape(a)}))
+ nquery.push("header_" + stuff[k] + "=" + encodeURIComponent(m[1]))
}
}
}
@@ -4503,10 +4503,10 @@ function search(q, d, nopush, all) {
clearCalendarHover()
// As usual, push new history state
- if (!nopush) window.history.pushState({}, "", "list.html?" + listname + "@" + domain + ":" + d + ":" + escape(q));
+ if (!nopush) window.history.pushState({}, "", "list.html?" + listname + "@" + domain + ":" + d + ":" + encodeURIComponent(q));
// get the data from backend, push to page builder func
- GetAsync("/api/stats.lua?list=" + listname + "&domain=" + domain + "&q=" + q.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "&d=" + d, null, buildPage)
+ GetAsync("/api/stats.lua?list=" + listname + "&domain=" + domain + "&q=" + encodeURIComponent(q) + "&d=" + d, null, buildPage)
// for the list title, prepare the date range
// TODO: improve this much like we have with trends.html
@@ -4534,14 +4534,14 @@ function searchAll(q, dspan, from, subject, where) {
wherel = a[0]
whered = a[1]
}
- var url = "/api/stats.lua?list="+wherel+"&domain="+whered+"&q=" + q.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "&d=" + escape(dspan)
+ var url = "/api/stats.lua?list="+wherel+"&domain="+whered+"&q=" + encodeURIComponent(q) + "&d=" + encodeURIComponent(dspan)
if (from) {
- url += "&header_from=" + "\""+ from.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
- current_query += " FROM:" + "\""+ from.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
+ url += "&header_from=" + "\""+ encodeURIComponent(from) + "\""
+ current_query += " FROM:" + "\""+ encodeURIComponent(from) + "\""
}
if (subject) {
- url += "&header_subject=\"" + subject.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
- current_query += " SUBJECT:\"" + subject.replace(/([\s&+=%])/g, function(a) { return escape(a)}) + "\""
+ url += "&header_subject=\"" + encodeURIComponent(subject) + "\""
+ current_query += " SUBJECT:\"" + encodeURIComponent(subject) + "\""
}
GetAsync(url, {
deep: true
@@ -5048,7 +5048,7 @@ function gatherTrends() {
if (m) {
query = query.replace(m[0], "")
// append to the header_foo query
- nquery += "&header_" + stuff[k] + "=" + escape(m[1])
+ nquery += "&header_" + stuff[k] + "=" + encodeURIComponent(m[1])
}
}
}
@@ -5070,7 +5070,7 @@ function gatherTrends() {
var domain = arr[1]
// Get us some data
- GetAsync('/api/stats.lua?list='+listname+'&domain='+domain+'&d=' + xa[0] + "&q=" + ((query && query.length > 0) ? escape(query) : "") + nquery, { nquery: nquery, listname: listname, domain: domain, dbl: xa[0], dfrom: xa[1], dto: xa[2], tspan: xa[3], dspan: dspan, query: query }, showTrends)
+ GetAsync('/api/stats.lua?list='+listname+'&domain='+domain+'&d=' + xa[0] + "&q=" + ((query && query.length > 0) ? encodeURIComponent(query) : "") + nquery, { nquery: nquery, listname: listname, domain: domain, dbl: xa[0], dfrom: xa[1], dto: xa[2], tspan: xa[3], dspan: dspan, query: query }, showTrends)
document.title = "Stats for " + list + " - Pony Mail!"
}