From 2ad7fe09526461b9803d9978123a5759830613b7 Mon Sep 17 00:00:00 2001 From: Mark Date: Fri, 24 Mar 2023 10:44:27 +1100 Subject: [PATCH] Safety check for valid root_path If the root_path has a trailing slash, fix_storage will encounter an infinite loop. --- fs_gcsfs/_gcsfs.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs_gcsfs/_gcsfs.py b/fs_gcsfs/_gcsfs.py index 6c869bf..fc9653d 100644 --- a/fs_gcsfs/_gcsfs.py +++ b/fs_gcsfs/_gcsfs.py @@ -70,6 +70,8 @@ def __init__(self, if not root_path: root_path = "" self.root_path = root_path + if self.root_path.endswith("/"): + raise ValueError("root_path must not end with a slash") self._prefix = relpath(normpath(root_path)).rstrip(self.DELIMITER) self.strict = strict