-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing existence check for directories. Fixes #16
- Loading branch information
Showing
2 changed files
with
8 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -259,7 +259,11 @@ def exists(self, name): | |
Returns True if a file referenced by the given name already exists in the | ||
storage system, or False if the name is available for a new file. | ||
""" | ||
return self._get_key(name).exists() | ||
# We also need to check for directory existence, so we'll list matching | ||
# keys and return success if any match. | ||
for _ in self.bucket.list(prefix=self._get_key_name(name)): | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
etianen
Author
Owner
|
||
return True | ||
return False | ||
|
||
def listdir(self, path): | ||
""" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This causes false positives for keys that have the same prefix.
"css/main.css.map" existing on s3 for "css/main.css" would cause this to return true.
Do we need to check for directory existence in this method? the docs state this is just for files?