xm-hooks: list of selected files; closes #921

previously, `xm` hooks would be called with the `txt` property
containing the url-decoded message

now, a new property `body` contains the original unmodified message,
to avoid any ambiguity caused by url-decoding

if any files are selected, the list of files is appended to
the `txt` field as lines, and as `sel` url-parameters in `body`

Co-authored-by: Carson Coder <carson@carsoncoder.com>
This commit is contained in:
ed
2025-10-14 19:39:03 +00:00
parent d099e5e84e
commit 6c024dbf80
7 changed files with 35 additions and 28 deletions

View File

@@ -2144,7 +2144,7 @@ class HttpCli(object):
t = "urlform_raw %d @ %r\n %r\n"
self.log(t % (len(orig), "/" + self.vpath, orig))
try:
zb = unquote(buf.replace(b"+", b" "))
zb = unquote(buf.replace(b"+", b" ").replace(b"&", b"\n"))
plain = zb.decode("utf-8", "replace")
if buf.startswith(b"msg="):
plain = plain[4:]
@@ -2165,7 +2165,7 @@ class HttpCli(object):
len(buf),
self.ip,
time.time(),
plain,
[plain, orig],
)
t = "urlform_dec %d @ %r\n %r\n"
@@ -2326,7 +2326,7 @@ class HttpCli(object):
remains,
self.ip,
at,
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -2461,7 +2461,7 @@ class HttpCli(object):
post_sz,
self.ip,
at,
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -3299,7 +3299,7 @@ class HttpCli(object):
0,
self.ip,
time.time(),
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -3471,7 +3471,7 @@ class HttpCli(object):
0,
self.ip,
at,
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -3578,7 +3578,7 @@ class HttpCli(object):
sz,
self.ip,
at,
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -3891,7 +3891,7 @@ class HttpCli(object):
0,
self.ip,
time.time(),
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr:
@@ -3939,7 +3939,7 @@ class HttpCli(object):
sz,
self.ip,
new_lastmod,
"",
None,
)
t = hr.get("rejectmsg") or ""
if t or not hr: