Skip to content

Commit

Permalink
Don't create RepeatFile for virtual paths in binary mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
takacsd committed Nov 22, 2023
1 parent 49c91ad commit d561d24
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions visidata/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ def open(self, mode='rt', encoding=None, encoding_errors=None, newline=None):
return self.rfile.reopen()

if self.fp:
self.fptext = codecs.iterdecode(self.fp,
encoding=encoding or vd.options.encoding,
errors=encoding_errors or vd.options.encoding_errors)
if 'b' not in mode:
self.fptext = codecs.iterdecode(self.fp,
encoding=encoding or vd.options.encoding,
errors=encoding_errors or vd.options.encoding_errors)

if self.fptext:
self.rfile = RepeatFile(self.fptext)
Expand Down

0 comments on commit d561d24

Please # to comment.