nvim-telescope / telescope-file-browser.nvim

File Browser extension for telescope.nvim
MIT License
1.73k stars 93 forks source link

mime type check leaks error message into prompt #133

Open miversen33 opened 2 years ago

miversen33 commented 2 years ago

Description

If you have a file with a truly awful file name (for example hello world %^&*()_-="'<,>.?|[{]}\), Telescope barfs and drops an error in the input box telling you that sh has cant resolve the name correctly. This error does not go away unless you close and reopen the file browser (and dont navigate to the awful file).

Discovered while testing another plugin and verified on my machine.

Neovim version

NVIM v0.7.0
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/gcc-11 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/runner/work/neovim/neovim/build/config -I/home/runner/work/neovim/neovim/src -I/home/runner/work/neovim/neovim/.deps/usr/include -I/usr/include -I/home/runner/work/neovim/neovim/build/src/nvim/auto -I/home/runner/work/neovim/neovim/build/include
Compiled by runner@fv-az316-460

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/home/runner/work/neovim/neovim/build/nvim.AppDir/usr/share/nvim"

Run :checkhealth for more info

Operating system and version

Ubuntu 20.04

Steps to reproduce

1) Create garbage file

$ touch "garbage%^&*()_-=\"'<,>.?|[{]}\"

2) Open neovim with minimal config

$ nvim -u minimal.lua

3) Open Telescope

:Telescope file_browser

4) Navigate cursor over garbage file Get the bork

Expected behavior

Telescope File Browser should be able to handle awful (but technically valid) file names

Actual behavior

String quoting failure it looks like?

Minimal config

-- minimal.lua
require('packer').startup(function(use)
    use 'nvim-telescope/telescope.nvim' -- Fuzzy Finder
    use "nvim-telescope/telescope-file-browser.nvim"

    if packer_bootstrap then
        require('packer').sync()
    end
end)
require("telescope").load_extension "file_browser"
miversen33 commented 2 years ago

Further notes, the file is opened when telling Telescope to open it, so it appears this is just a visual issue and not prohibitive to work flow.

Conni2461 commented 2 years ago

fd, for what its worth i've also seen this with live grep and other pickers but couldnt track it down yet. It only appeared randomly for me. I'll have to try these reproduce steps later

fdschmidt93 commented 2 years ago

It's the mime type check via file. I have the previewer turned off by default and didn't get that message in the prompt.

Commenting out mime-type checking immediately or using plenary.jobs as opposed to io.popen (as per https://github.com/nvim-telescope/telescope.nvim/pull/1910) immediately solves the problem as the error message just leaks from the way we currently do mime type checking.

I hope to be able to complete the previewer RFC before 0.1 but have an important conference deadline end of June. Let's see. I have no sense of urgency to quick fix this stand alone as I suppose it's a rather rare issue :sweat_smile: