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
The following commit(s) were added to refs/heads/master by this push:
new 89148ef widen scope for when to perform b64 decoding
89148ef is described below
commit 89148efef661dde19cb20e3e62864e7409a80aca
Author: Daniel Gruno <[email protected]>
AuthorDate: Wed Sep 15 09:54:41 2021 -0500
widen scope for when to perform b64 decoding
---
server/plugins/messages.py | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/server/plugins/messages.py b/server/plugins/messages.py
index a1456e9..195dcbc 100644
--- a/server/plugins/messages.py
+++ b/server/plugins/messages.py
@@ -251,17 +251,18 @@ async def get_source(session:
plugins.session.SessionObject, permalink: str = No
doctype = session.database.dbs.source
try:
doc = await session.database.get(index=doctype, id=permalink)
- return doc
except plugins.database.DBError:
- pass
- res = await session.database.search(
- index=doctype,
- size=1,
- body={"query": {"bool": {"must": [{"match": {"permalink":
permalink}}]}}},
- )
- if len(res["hits"]["hits"]) == 1:
- doc = res["hits"]["hits"][0]
- doc["id"] = doc["_id"]
+ doc = None
+ if not doc:
+ res = await session.database.search(
+ index=doctype,
+ size=1,
+ body={"query": {"bool": {"must": [{"match": {"permalink":
permalink}}]}}},
+ )
+ if len(res["hits"]["hits"]) == 1:
+ doc = res["hits"]["hits"][0]
+ doc["id"] = doc["_id"]
+ if doc:
if raw:
return doc
# Check for base64-encoded source