git » sdk » commit a86a7a4

Make sure we've looked up if we have in cache first

author Stephen Paul Weber
2026-07-21 17:39:09 UTC
committer Stephen Paul Weber
2026-07-21 17:39:09 UTC
parent 2ab331623368f7c28b0d24bad3d73221a299e6b0

Make sure we've looked up if we have in cache first

borogove/Client.hx +4 -2

diff --git a/borogove/Client.hx b/borogove/Client.hx
index 6bdd87b..a2d3f69 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -1771,8 +1771,10 @@ class Client extends EventEmitter {
 		final chatDomain = JID.parse(chat.chatId).domain;
 		final ps = [];
 		for (attachment in message.attachments) {
-			if (attachment.cachedAt != null && attachment.uris.find(uri -> uri.split("/")[2].split(":")[0].endsWith(chatDomain)) != null) {
-				ps.push(fetchAttachment(attachment));
+			if (attachment.uris.find(uri -> uri.split("/")[2].split(":")[0].endsWith(chatDomain)) != null) {
+				attachment.lookup(persistence).then(lookedUp -> {
+					if (lookedUp.cachedAt == null) ps.push(fetchAttachment(attachment));
+				});
 			}
 		}