dvcfs: prevent opening file object in write mode

This commit is contained in:
Saugat Pachhai (सौगात)
2022-09-16 11:31:24 +03:00
committed by Ruslan Kuprieiev
parent 0fe8f4e368
commit c1f659bdd7
+4
View File
@@ -1,3 +1,4 @@
import errno
import logging
import ntpath
import os
@@ -222,6 +223,9 @@ class _DvcFileSystem(AbstractFileSystem): # pylint:disable=abstract-method
def _open(
self, path, mode="rb", **kwargs
): # pylint: disable=arguments-renamed, arguments-differ
if mode != "rb":
raise OSError(errno.EROFS, os.strerror(errno.EROFS))
key = self._get_key_from_relative(path)
fs_path = self._from_key(key)
try: