From b2e3485531b21709583f37ae75f87d4403c18b6f Mon Sep 17 00:00:00 2001
From: KameleonUK
Date: Thu, 4 Jun 2026 06:45:29 +0100
Subject: [PATCH] Fix: Tooltip error in other addons that hook itemlink for
tooltip
---
Core/Tooltip.lua | 15 +++++++--------
UI/ItemButton.lua | 12 ++++++++++--
2 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/Core/Tooltip.lua b/Core/Tooltip.lua
index add1d2c..a7db598 100644
--- a/Core/Tooltip.lua
+++ b/Core/Tooltip.lua
@@ -483,15 +483,14 @@ function Tooltip:Initialize()
local oldSetHyperlink = GameTooltip.SetHyperlink
function GameTooltip:SetHyperlink(link)
return WithDeferredMoney(self, function()
+ -- The native Blizzard SetHyperlink only accepts a bare "item:ID:e:e:e" string.
+ -- Any addon that captured the native before Guda loaded (e.g. AtlasLoot) will
+ -- call it directly with whatever we pass here, so we MUST strip the color codes
+ -- and |H...|h wrapper before forwarding. Passing the full colored link causes
+ -- "unknown link type" in those addons.
local _, _, inner = string.find(link or "", "|H(.+)|h")
- local forwarded = link
- local itemLinkForCounts = link
- if inner then
- forwarded = inner
- if strfind(inner, "^item:") then
- itemLinkForCounts = inner
- end
- end
+ local forwarded = inner or link
+ local itemLinkForCounts = inner or link
local ret = oldSetHyperlink(self, forwarded)
if itemLinkForCounts and strfind(itemLinkForCounts, "item:") then
Tooltip:AddInventoryInfo(self, itemLinkForCounts)
diff --git a/UI/ItemButton.lua b/UI/ItemButton.lua
index 5755b18..90f38a3 100644
--- a/UI/ItemButton.lua
+++ b/UI/ItemButton.lua
@@ -2524,10 +2524,18 @@ function Guda_ItemButton_OnEnter(self)
GameTooltip:SetHyperlink(self.itemData.link)
end
elseif self.bagID == -2 then
- -- Keyring: SetBagItem might be unreliable for -2 in some 1.12.1 environments, fallback to hyperlink if needed
+ -- Keyring (bag -2): in 1.12 the native SetBagItem builds the keyring tooltip
+ -- by internally calling SetHyperlink with the FULL colored link
+ -- (|cff..|Hitem:..|h[Name]|h|r). When other addons (AtlasLoot, WoWTranslate)
+ -- have re-hooked SetHyperlink in an order that bypasses Guda's stripping, that
+ -- full link reaches a hook whose captured original is the raw Blizzard
+ -- SetHyperlink — which only accepts the BARE "item:ID:0:0:0" form and otherwise
+ -- throws "unknown link type". We avoid that internal path entirely by calling
+ -- SetHyperlink ourselves with the bare form extracted from the container link.
local link = GetContainerItemLink(self.bagID, self.slotID)
if link then
- GameTooltip:SetHyperlink(link)
+ local _, _, bare = string.find(link, "|H(item:[^|]+)|h")
+ GameTooltip:SetHyperlink(bare or link)
else
GameTooltip:SetBagItem(self.bagID, self.slotID)
end