From 402c7dd306e91b45e0f875d19907e181c6de14e4 Mon Sep 17 00:00:00 2001 From: Joe Lim <50560759+joelim-work@users.noreply.github.com> Date: Wed, 11 Mar 2026 15:19:03 +1100 Subject: [PATCH] fix: handle empty argument for `select` (#2429) * fix: handle empty argument for `select` * Update `CHANGELOG.md` --- CHANGELOG.md | 1 + eval.go | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 99000dce..032f29db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), - A bug where the `loading...` message was not displayed for volatile previews after the first time is now fixed (#2410). - The `cmd-transpose` command now advances the cursor correctly after swapping characters (#2413). - Symbolic links are no longer followed when changing directories (#2423). +- Using the `select` command with a blank string as the argument now properly raises an error instead of changing to the parent directory (#2429). ## [r41](https://github.com/gokcehan/lf/releases/tag/r41) diff --git a/eval.go b/eval.go index 66879d83..5ea2b468 100644 --- a/eval.go +++ b/eval.go @@ -1516,13 +1516,14 @@ func (e *callExpr) eval(app *app, _ []string) { return } - path, err := filepath.Abs(replaceTilde(e.args[0])) + path := replaceTilde(e.args[0]) + lstat, err := os.Lstat(path) if err != nil { app.ui.echoerrf("select: %s", err) return } - lstat, err := os.Lstat(path) + path, err = filepath.Abs(replaceTilde(e.args[0])) if err != nil { app.ui.echoerrf("select: %s", err) return