How can I make assets publicly available?

How can I make assets publicly available without needing to add the folder name into rules everytime I create a new folder?

Currently I am doing something like this

For info, all of this folders are inside the folder I named public. This approach works okay, but when I tried to create a subfolder under one of this, the files (images) inside are not accessible unless I add the folder name to the rule. Can I just make a rule for my folder named “public” and all assets inside subfolders be accessible publicly?

Sorry I am still learning directus. I hope someone can help. Thanks

1 Answer

1

folder.parent should do the trick:

I have a question. Will this also work lets say the file is in public/subOne/subTwo/fileHere or only files only files in subFolders closest to public? Thanks a lot

Unfortunately that approach doesn't work with deeper nested folders since afaik Directus filters don't support recursion. In that case you would need to use some kind of labeling or other creative filtering. There has been a discussion on Github about this: https://github.com/directus/directus/discussions/14353