S3 uses the key attribute to somehow identify a tree hierarchy. However, the key is arbitrary and programatically, it is possible to add into S3 assets without a parent folder.
For instance, you could create these assets:
And it is not required to create the folder object with key
In such a case, the assets above would not be shown in the S3 tree. Notice that if you use the S3 console, this would never happen, as you always have to create the folder.
- Detect orphans assets rendering the tree
- Generate on the fly the missing folders.
For instance, in the example above, the folder /bucket/20201014 should be shown in the tree.