There was an error while loading. Please reload this page.
1 parent 28ce036 commit 6923649Copy full SHA for 6923649
1 file changed
cloudpathlib/s3/s3path.py
@@ -83,9 +83,13 @@ def bucket(self) -> str:
83
84
:type: :class:`str`
85
"""
86
+ if hasattr(self, "_bucket"):
87
+ return self._bucket
88
if match := _MRAP_PATTERN.match(str(self)):
- return match.group("arn")
- return self._no_prefix.split("/", 1)[0]
89
+ self._bucket = match.group("arn")
90
+ else:
91
+ self._bucket = self._no_prefix.split("/", 1)[0]
92
93
94
@property
95
def key(self) -> str:
0 commit comments