SvenWerlen / moulinette-core

FoundryVTT module which provides a set of tools for DMs for managing assets.
https://www.patreon.com/moulinette
MIT License
41 stars 10 forks source link

Indexing doesn't work when folder name includes a "." #61

Closed SvenWerlen closed 9 months ago

SvenWerlen commented 1 year ago

Not sure this is the right place for this- if there is a period "." in a Folder Name, Indexing goes into an infinite loop Moulinette FileUtil | Assets: scanning moulinette/tiles/custom/Maps/Underground Dungeon/InfinityDungeon_2.2 ... moulinette-file-util.js:443 Moulinette FileUtil | Assets: 0 assets found moulinette-file-util.js:445 Moulinette FileUtil | Assets: 0 assets kepts after filtering moulinette-file-util.js:434 then repeats starting with Moulinette FileUtil | Assets: scanning moulinette/tiles/custom/Maps/Underground Dungeon/InfinityDungeon_2.2 ...

SvenWerlen commented 1 year ago

From Hiatea#7873 on Discord (#troubleshooting)

LukeAbby commented 1 year ago

The period makes it look like a file. It's a core Foundry bug: https://github.com/foundryvtt/foundryvtt/issues/8935. It will be fixed in V11 but can be patched fairly easily in the meantime.

The issue I opened goes into great detail but one thing I didn't mention this in the initial issue because it was already long was that it seems that ultimately aws-sdk misguidedly tries its best to match the behaviour of ls as you can see:

> touch foo
> ls foo
foo
> rm foo
> mkdir foo
> ls foo
[empty]
> touch foo/bar
> ls foo
bar
> rm -r foo

The key part is that when you have just a file ls just echos the file's name back to you.

Now in S3 we don't ACTUALLY have a "file", S3 only has what it calls objects which are close to files but they can have /s in the name. For this reason aws-sdk is really just guessing if something is meant to be a "file" or "folder" . Because it judges off of an "extension" this ultimately ends up with a/b/c.d echoing back a/b/c.d and this ends up making it try to traverse into, well, a/b/c.d ad infinitum.

SvenWerlen commented 1 year ago

Wow, this is a very detailed explanation of the issue. Thank you, I appreciate. I'll then wait and check it on V11.

SvenWerlen commented 1 year ago

Would you mind confirming that the issue is fixed in V11? (I would then close this issue)

SvenWerlen commented 9 months ago

Tested on V11. Works as expected.