ranger / ranger

A VIM-inspired filemanager for the console
https://ranger.fm
GNU General Public License v3.0
15.58k stars 892 forks source link

Crash when highlighting file with special characters in filename #2119

Closed lukas-mertens closed 4 years ago

lukas-mertens commented 4 years ago

Runtime Environment

Current Behavior

Ranger crashes when I highlight the file (navigate to it, not select it).

Expected Behavior

A preview of the pdf is shown.

Traceback

ranger version: ranger-master
Python version: 3.8.5 (default, Sep  5 2020, 10:50:12) [GCC 10.2.0]
Locale: de_DE.UTF-8
Current file: '/path/to/my/file/Arbeitszeitnachweis_f\udc81r Minijobber_2020_09.PDF'

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/ranger/core/main.py", line 203, in main
    fm.loop()
  File "/usr/lib/python3.8/site-packages/ranger/core/fm.py", line 376, in loop
    ui.redraw()
  File "/usr/lib/python3.8/site-packages/ranger/gui/ui.py", line 343, in redraw
    self.draw()
  File "/usr/lib/python3.8/site-packages/ranger/gui/ui.py", line 370, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.8/site-packages/ranger/gui/displayable.py", line 257, in draw
    displayable.draw()
  File "/usr/lib/python3.8/site-packages/ranger/gui/widgets/view_miller.py", line 100, in draw
    DisplayableContainer.draw(self)
  File "/usr/lib/python3.8/site-packages/ranger/gui/displayable.py", line 257, in draw
    displayable.draw()
  File "/usr/lib/python3.8/site-packages/ranger/gui/widgets/browsercolumn.py", line 187, in draw
    self._draw_file()
  File "/usr/lib/python3.8/site-packages/ranger/gui/widgets/browsercolumn.py", line 206, in _draw_file
    path = self.target.get_preview_source(self.wid, self.hei)
  File "/usr/lib/python3.8/site-packages/ranger/container/file.py", line 96, in get_preview_source
    return self.fm.get_preview(self, width, height)
  File "/usr/lib/python3.8/site-packages/ranger/core/actions.py", line 1101, in get_preview
    self.sha512_encode(path, inode=fobj.stat.st_ino)
  File "/usr/lib/python3.8/site-packages/ranger/core/actions.py", line 1028, in sha512_encode
    inode_path = inode_path.encode('utf-8', 'backslashescape')
LookupError: unknown error handler name 'backslashescape'

ranger crashed. Please report this traceback at:
https://github.com/ranger/ranger/issues
toonn commented 4 years ago

Thank you for catching this! Silly bug.