Skip to content

Commit

Permalink
Merge pull request #528 from EOxServer/vsi_open
Browse files Browse the repository at this point in the history
fixing VSIFile return value
  • Loading branch information
baloola committed Jul 21, 2022
2 parents 0c223a7 + daadc3b commit 21770a7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion eoxserver/contrib/vsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,14 @@ def read(self, size=UINT32_MAX):
"""

value = VSIFReadL(1, size, self._handle)
return value if value is not None else ''
if isinstance(value, bytes):
return value
elif isinstance(value, bytearray):
return bytes(value)
elif value is None:
return b''
else:
raise ValueError(value)

@_ensure_open
def write(self, data):
Expand Down

0 comments on commit 21770a7

Please sign in to comment.