1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

fix: ls.Get calls use top-relative index (#537)

Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
James Hillyerd
2024-10-04 21:26:31 -07:00
committed by GitHub
parent 35549d9bf1
commit 8097b3cc8a

View File

@@ -165,7 +165,7 @@ func (h *Host) handleBeforeMailAccepted(addr event.AddressParts) *bool {
return nil
}
lval := ls.Get(1)
lval := ls.Get(-1)
ls.Pop(1)
logger.Debug().Msgf("Lua function returned %q (%v)", lval, lval.Type().String())
@@ -197,7 +197,8 @@ func (h *Host) handleBeforeMessageStored(msg event.InboundMessage) *event.Inboun
return nil
}
lval := ls.Get(1)
lval := ls.Get(-1)
ls.Pop(1)
logger.Debug().Msgf("Lua function returned %q (%v)", lval, lval.Type().String())
if lval.Type() == lua.LTNil || lua.LVIsFalse(lval) {
@@ -208,7 +209,6 @@ func (h *Host) handleBeforeMessageStored(msg event.InboundMessage) *event.Inboun
if err != nil {
logger.Error().Err(err).Msg("Bad response from Lua Function")
}
ls.Pop(1)
return result
}