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 2024/12/06 16:09:59 UTC
(incubator-ponymail-foal) branch master updated (4e738c3 -> cbbc26c)
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
from 4e738c3 Bump version
new 9f32148 Saved search handling does not take account of special characters
new cbbc26c Bump JS version
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
webui/admin.html | 8 ++++----
webui/index.html | 6 +++---
webui/js/ponymail.js | 38 +++++++++++++++++++++++++-------------
webui/js/source/search.js | 36 ++++++++++++++++++++++++------------
webui/list.html | 8 ++++----
webui/oauth.html | 8 ++++----
webui/thread.html | 8 ++++----
7 files changed, 68 insertions(+), 44 deletions(-)
(incubator-ponymail-foal) 01/02: Saved search handling does not take account of special characters
Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 9f321487094383ffb6e7b3425a265562cdd503d7
Author: Sebb <se...@apache.org>
AuthorDate: Fri Dec 6 16:09:15 2024 +0000
Saved search handling does not take account of special characters
This fixes #266
---
webui/js/source/search.js | 36 ++++++++++++++++++++++++------------
1 file changed, 24 insertions(+), 12 deletions(-)
diff --git a/webui/js/source/search.js b/webui/js/source/search.js
index 8f69425..c342808 100644
--- a/webui/js/source/search.js
+++ b/webui/js/source/search.js
@@ -38,26 +38,37 @@ function search(query, date) {
let header_to = document.getElementById('header_to');
let header_body = document.getElementById('header_body');
let header_messageid = document.getElementById('header_messageid');
- let qparts = query.split('&'); // look for additional query options
+ /*
+ * See https://github.com/apache/incubator-ponymail-foal/issues/266
+ *
+ * The newhref URL parameter values should have been encoded.
+ * However changing this now might invalidate existing URLs.
+ * A work-round is to avoid splitting on '&' alone.
+ * We know what parameter names to expect, so can look for them.
+ * Also, the split() function discards excess parts, so use indexOf instead.
+ */
+ let qparts = query.split('&header_'); // look for additional query options (all start with header_)
if (qparts.length > 0) { // i.e. query + header bits
query = qparts.shift(); // Keep only the query
// store the values to be picked up below
for (let part of qparts) {
- let hv = part.split('=',2);
- if (hv[0] == 'header_from') {
- header_from.value = hv[1];
+ let sep = part.indexOf('='); // find separator
+ let key = part.substring(0, sep);
+ let value = part.substring(sep+1)
+ if (key == 'from') {
+ header_from.value = value;
}
- if (hv[0] == 'header_subject') {
- header_subject.value = hv[1];
+ if (key == 'subject') {
+ header_subject.value = value;
}
- if (hv[0] == 'header_to') {
- header_to.value = hv[1];
+ if (key == 'to') {
+ header_to.value = value;
}
- if (hv[0] == 'header_body') {
- header_body.value = hv[1];
+ if (key == 'body') {
+ header_body.value = value;
}
- if (hv[0] == 'header_messageid') {
- header_messageid.value = hv[1];
+ if (key == 'messageid') {
+ header_messageid.value = value;
}
// N.B. other options are currently ignored
}
@@ -66,6 +77,7 @@ function search(query, date) {
let sURL = '%sapi/stats.lua?d=%s&list=%s&domain=%s&q=%s'.format(
G_apiURL, encodeURIComponent(date), encodeURIComponent(list), encodeURIComponent(domain), encodeURIComponent(query)
);
+ // See above: newhref values should have been encoded, but doing so now might invalidate existing URLs
if (header_from.value.length > 0) {
sURL += "&header_from=%s".format(encodeURIComponent(header_from.value));
newhref += "&header_from=%s".format(header_from.value);
(incubator-ponymail-foal) 02/02: Bump JS version
Posted by se...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit cbbc26cd5c2c27249afffab333dcf1c0cca4a80b
Author: Sebb <se...@apache.org>
AuthorDate: Fri Dec 6 16:09:49 2024 +0000
Bump JS version
---
webui/admin.html | 8 ++++----
webui/index.html | 6 +++---
webui/js/ponymail.js | 38 +++++++++++++++++++++++++-------------
webui/list.html | 8 ++++----
webui/oauth.html | 8 ++++----
webui/thread.html | 8 ++++----
6 files changed, 44 insertions(+), 32 deletions(-)
diff --git a/webui/admin.html b/webui/admin.html
index 0c7b75a..d47f163 100644
--- a/webui/admin.html
+++ b/webui/admin.html
@@ -25,7 +25,7 @@ the License. -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="all">
- <link href="css/scaffolding.css?revision=8f2da38" rel="stylesheet" media="all">
+ <link href="css/scaffolding.css?revision=9f32148" rel="stylesheet" media="all">
<link href="css/modal.css" rel="stylesheet" media="all">
<link href="css/spinner.css" rel="stylesheet" media="all">
<link rel="alternate" href="/api/static.lua"/>
@@ -79,9 +79,9 @@ the License. -->
<script src="js/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
- <script src="js/config.js?revision=8f2da38"></script>
- <script src="js/wordcloud.js?revision=8f2da38"></script>
- <script src="js/ponymail.js?revision=8f2da38"></script>
+ <script src="js/config.js?revision=9f32148"></script>
+ <script src="js/wordcloud.js?revision=9f32148"></script>
+ <script src="js/ponymail.js?revision=9f32148"></script>
<div id="splash" class="splash fade-in"> </div>
<div style="clear: both;"></div>
</body>
diff --git a/webui/index.html b/webui/index.html
index 8d549ce..79e2aa1 100644
--- a/webui/index.html
+++ b/webui/index.html
@@ -24,7 +24,7 @@ the License. -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="all">
- <link href="css/scaffolding.css?revision=8f2da38" rel="stylesheet" media="all">
+ <link href="css/scaffolding.css?revision=9f32148" rel="stylesheet" media="all">
<link href="css/modal.css" rel="stylesheet" media="all">
<link href="css/spinner.css" rel="stylesheet" media="all">
<link rel="alternate" href="/api/static.lua"/>
@@ -63,8 +63,8 @@ the License. -->
<script src="js/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
- <script src="js/config.js?revision=8f2da38"></script>
- <script src="js/ponymail.js?revision=8f2da38"></script>
+ <script src="js/config.js?revision=9f32148"></script>
+ <script src="js/ponymail.js?revision=9f32148"></script>
<div id="splash" class="splash fade-in"> </div>
<div style="clear: both;"></div>
diff --git a/webui/js/ponymail.js b/webui/js/ponymail.js
index e465701..6fa9516 100644
--- a/webui/js/ponymail.js
+++ b/webui/js/ponymail.js
@@ -16,7 +16,7 @@
*/
// THIS IS AN AUTOMATICALLY COMBINED FILE. PLEASE EDIT THE source/ FILES!
-const PONYMAIL_REVISION = '8f2da38';
+const PONYMAIL_REVISION = '9f32148';
/******************************************
@@ -4202,26 +4202,37 @@ function search(query, date) {
let header_to = document.getElementById('header_to');
let header_body = document.getElementById('header_body');
let header_messageid = document.getElementById('header_messageid');
- let qparts = query.split('&'); // look for additional query options
+ /*
+ * See https://github.com/apache/incubator-ponymail-foal/issues/266
+ *
+ * The newhref URL parameter values should have been encoded.
+ * However changing this now might invalidate existing URLs.
+ * A work-round is to avoid splitting on '&' alone.
+ * We know what parameter names to expect, so can look for them.
+ * Also, the split() function discards excess parts, so use indexOf instead.
+ */
+ let qparts = query.split('&header_'); // look for additional query options (all start with header_)
if (qparts.length > 0) { // i.e. query + header bits
query = qparts.shift(); // Keep only the query
// store the values to be picked up below
for (let part of qparts) {
- let hv = part.split('=',2);
- if (hv[0] == 'header_from') {
- header_from.value = hv[1];
+ let sep = part.indexOf('='); // find separator
+ let key = part.substring(0, sep);
+ let value = part.substring(sep+1)
+ if (key == 'from') {
+ header_from.value = value;
}
- if (hv[0] == 'header_subject') {
- header_subject.value = hv[1];
+ if (key == 'subject') {
+ header_subject.value = value;
}
- if (hv[0] == 'header_to') {
- header_to.value = hv[1];
+ if (key == 'to') {
+ header_to.value = value;
}
- if (hv[0] == 'header_body') {
- header_body.value = hv[1];
+ if (key == 'body') {
+ header_body.value = value;
}
- if (hv[0] == 'header_messageid') {
- header_messageid.value = hv[1];
+ if (key == 'messageid') {
+ header_messageid.value = value;
}
// N.B. other options are currently ignored
}
@@ -4230,6 +4241,7 @@ function search(query, date) {
let sURL = '%sapi/stats.lua?d=%s&list=%s&domain=%s&q=%s'.format(
G_apiURL, encodeURIComponent(date), encodeURIComponent(list), encodeURIComponent(domain), encodeURIComponent(query)
);
+ // See above: newhref values should have been encoded, but doing so now might invalidate existing URLs
if (header_from.value.length > 0) {
sURL += "&header_from=%s".format(encodeURIComponent(header_from.value));
newhref += "&header_from=%s".format(header_from.value);
diff --git a/webui/list.html b/webui/list.html
index 420ea4f..9b1d209 100644
--- a/webui/list.html
+++ b/webui/list.html
@@ -24,7 +24,7 @@ the License. -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="all">
- <link href="css/scaffolding.css?revision=8f2da38" rel="stylesheet" media="all">
+ <link href="css/scaffolding.css?revision=9f32148" rel="stylesheet" media="all">
<link href="css/modal.css" rel="stylesheet" media="all">
<link href="css/spinner.css" rel="stylesheet" media="all">
<link rel="alternate" href="/api/static.lua"/>
@@ -180,9 +180,9 @@ the License. -->
</script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
- <script src="js/config.js?revision=8f2da38"></script>
- <script src="js/wordcloud.js?revision=8f2da38"></script>
- <script src="js/ponymail.js?revision=8f2da38"></script>
+ <script src="js/config.js?revision=9f32148"></script>
+ <script src="js/wordcloud.js?revision=9f32148"></script>
+ <script src="js/ponymail.js?revision=9f32148"></script>
<div id="splash" class="splash fade-in"> </div>
<div style="clear: both;"></div>
<script type="text/javascript">
diff --git a/webui/oauth.html b/webui/oauth.html
index 0e974ae..5ecaab9 100644
--- a/webui/oauth.html
+++ b/webui/oauth.html
@@ -21,7 +21,7 @@ the License. -->
<!-- CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="all">
- <link href="css/scaffolding.css?revision=8f2da38" rel="stylesheet" media="all">
+ <link href="css/scaffolding.css?revision=9f32148" rel="stylesheet" media="all">
<link href="css/modal.css" rel="stylesheet" media="all">
<link href="css/spinner.css" rel="stylesheet" media="all">
@@ -54,8 +54,8 @@ the License. -->
<script src="js/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
- <script src="js/config.js?revision=8f2da38"></script>
- <script src="js/ponymail.js?revision=8f2da38"></script>
- <script src="js/oauth.js?revision=8f2da38"></script>
+ <script src="js/config.js?revision=9f32148"></script>
+ <script src="js/ponymail.js?revision=9f32148"></script>
+ <script src="js/oauth.js?revision=9f32148"></script>
</body>
</html>
diff --git a/webui/thread.html b/webui/thread.html
index 435c06e..01fde49 100644
--- a/webui/thread.html
+++ b/webui/thread.html
@@ -25,7 +25,7 @@ the License. -->
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet" media="all">
- <link href="css/scaffolding.css?revision=8f2da38" rel="stylesheet" media="all">
+ <link href="css/scaffolding.css?revision=9f32148" rel="stylesheet" media="all">
<link href="css/modal.css" rel="stylesheet" media="all">
<link href="css/spinner.css" rel="stylesheet" media="all">
<link rel="alternate" href="/api/static.lua"/>
@@ -97,9 +97,9 @@ the License. -->
<script src="js/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ="></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
- <script src="js/config.js?revision=8f2da38"></script>
- <script src="js/wordcloud.js?revision=8f2da38"></script>
- <script src="js/ponymail.js?revision=8f2da38"></script>
+ <script src="js/config.js?revision=9f32148"></script>
+ <script src="js/wordcloud.js?revision=9f32148"></script>
+ <script src="js/ponymail.js?revision=9f32148"></script>
<div id="splash" class="splash fade-in"> </div>
<div style="clear: both;"></div>
</body>