You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ponymail.apache.org by hu...@apache.org on 2022/01/24 22:39:45 UTC
[incubator-ponymail-foal] 01/02: work around find_parent being doubly encoded.
This is an automated email from the ASF dual-hosted git repository.
humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
commit 335c5f07e30f7ded480ff8dd09a52d7e444f7a84
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Mon Jan 24 23:38:27 2022 +0100
work around find_parent being doubly encoded.
---
webui/js/source/primer.js | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/webui/js/source/primer.js b/webui/js/source/primer.js
index e9a8d0a..2ea3fb2 100644
--- a/webui/js/source/primer.js
+++ b/webui/js/source/primer.js
@@ -172,7 +172,12 @@ function parse_permalink() {
});
}
else {
- GET('%sapi/thread.lua?id=%s'.format(G_apiURL, encodeURIComponent(mid)), construct_single_thread, {
+ let encoded_mid = encodeURIComponent(mid);
+ // If looking for parent, don't encode this bit of the arg string.
+ if (mid.match(/&find_parent=true/)) {
+ encoded_mid = encodeURIComponent(mid.replace(/&find_parent=true/, '')) + '&find_parent=true';
+ }
+ GET('%sapi/thread.lua?id=%s'.format(G_apiURL, encoded_mid), construct_single_thread, {
cached: true
});
}
Re: [incubator-ponymail-foal] 01/02: work around find_parent being doubly encoded.
Posted by sebb <se...@gmail.com>.
On Mon, 24 Jan 2022 at 22:39, <hu...@apache.org> wrote:
>
> This is an automated email from the ASF dual-hosted git repository.
>
> humbedooh pushed a commit to branch master
> in repository https://gitbox.apache.org/repos/asf/incubator-ponymail-foal.git
>
> commit 335c5f07e30f7ded480ff8dd09a52d7e444f7a84
> Author: Daniel Gruno <hu...@apache.org>
> AuthorDate: Mon Jan 24 23:38:27 2022 +0100
>
> work around find_parent being doubly encoded.
-1
I think the work-round is wrong.
Your fix does not retrieve the correct mid until it has already been used.
Also '&find_parent=true' is valid as part of a message-id, so your fix
could potentially corrupt a search by message-id.
The way that the find_parent attribute is passed needs a rethink.
> ---
> webui/js/source/primer.js | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/webui/js/source/primer.js b/webui/js/source/primer.js
> index e9a8d0a..2ea3fb2 100644
> --- a/webui/js/source/primer.js
> +++ b/webui/js/source/primer.js
> @@ -172,7 +172,12 @@ function parse_permalink() {
> });
> }
> else {
> - GET('%sapi/thread.lua?id=%s'.format(G_apiURL, encodeURIComponent(mid)), construct_single_thread, {
> + let encoded_mid = encodeURIComponent(mid);
> + // If looking for parent, don't encode this bit of the arg string.
> + if (mid.match(/&find_parent=true/)) {
> + encoded_mid = encodeURIComponent(mid.replace(/&find_parent=true/, '')) + '&find_parent=true';
> + }
> + GET('%sapi/thread.lua?id=%s'.format(G_apiURL, encoded_mid), construct_single_thread, {
> cached: true
> });
> }