diff --git a/action.go b/action.go index 8610ed825..a7c801df6 100644 --- a/action.go +++ b/action.go @@ -132,11 +132,7 @@ func (a Action) StyleF(f func(s string, sc style.Context) string) Action { return ActionCallback(func(c Context) Action { invoked := a.Invoke(c) for index, v := range invoked.rawValues { - path, err := c.Abs(v.Value) - if err != nil { - return ActionMessage(err.Error()) - } - invoked.rawValues[index].Style = f(path, c) + invoked.rawValues[index].Style = f(v.Value, c) } return invoked.ToA() }) diff --git a/pkg/style/path.go b/pkg/style/path.go index e9eb52425..7b22bf861 100644 --- a/pkg/style/path.go +++ b/pkg/style/path.go @@ -15,6 +15,9 @@ type Context interface { // // /tmp/locally/reachable/file.txt func ForPath(path string, sc Context) string { + if abs, err := sc.Abs(path); err == nil { + path = abs + } return fromSGR(lscolors.GetColorist(sc.Getenv("LS_COLORS")).GetStyle(path)) }