/ is not a principal
This commit is contained in:
		| @@ -355,25 +355,27 @@ class Collection(BaseCollection): | |||||||
|         # path should already be sanitized |         # path should already be sanitized | ||||||
|         sane_path = sanitize_path(path).strip("/") |         sane_path = sanitize_path(path).strip("/") | ||||||
|         attributes = sane_path.split("/") |         attributes = sane_path.split("/") | ||||||
|         if not attributes: |         if not attributes[0]: | ||||||
|             return |             attributes.pop() | ||||||
|  |  | ||||||
|         # Try to guess if the path leads to a collection or an item |         # Try to guess if the path leads to a collection or an item | ||||||
|         folder = os.path.expanduser( |         folder = os.path.expanduser( | ||||||
|             cls.configuration.get("storage", "filesystem_folder")) |             cls.configuration.get("storage", "filesystem_folder")) | ||||||
|         if not os.path.isdir(path_to_filesystem(folder, sane_path)): |         if not os.path.isdir(path_to_filesystem(folder, sane_path)): | ||||||
|             # path is not a collection |             # path is not a collection | ||||||
|             if os.path.isfile(path_to_filesystem(folder, sane_path)): |             if attributes and os.path.isfile(path_to_filesystem(folder, | ||||||
|  |                                                                 sane_path)): | ||||||
|                 # path is an item |                 # path is an item | ||||||
|                 attributes.pop() |                 attributes.pop() | ||||||
|             elif os.path.isdir(path_to_filesystem(folder, *attributes[:-1])): |             elif attributes and os.path.isdir(path_to_filesystem( | ||||||
|  |                     folder, *attributes[:-1])): | ||||||
|                 # path parent is a collection |                 # path parent is a collection | ||||||
|                 attributes.pop() |                 attributes.pop() | ||||||
|             # TODO: else: return? |             # TODO: else: return? | ||||||
|  |  | ||||||
|         path = "/".join(attributes) |         path = "/".join(attributes) | ||||||
|  |  | ||||||
|         principal = len(attributes) <= 1 |         principal = len(attributes) == 1 | ||||||
|         collection = cls(path, principal) |         collection = cls(path, principal) | ||||||
|         yield collection |         yield collection | ||||||
|         if depth != "0": |         if depth != "0": | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Unrud
					Unrud