Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Soundboard not finding folder if path has multiple spaces #90

Open
rikmarais opened this issue Jan 3, 2023 · 1 comment
Open

Soundboard not finding folder if path has multiple spaces #90

rikmarais opened this issue Jan 3, 2023 · 1 comment

Comments

@rikmarais
Copy link

rikmarais commented Jan 3, 2023

Hi there 👋
I'm not certain whether this is in some way related to issue #89, but I can reproduce this on Forge and on locally hosted Foundry. Tested with Foundry 10.291 and Soundboard 1.7.1.

Perhaps both that issue and this issue are related to path escaping in some way.

Setting the Custom Soundboard Directory sometimes doesn't work

  • ✔️!Music works fine
  • ✔️Music Stuff works fine
  • Master Music Files doesn't work
  • ✔️!Master_Music_Files works fine
  • !Master Music Files doesn't work
  • 1 2 3 doesn't work

Common denominator seems to be number of spaces, and not special characters, but I didn't look deeply into the code. Hopefully this helps out in finding the issue!

image
image
image
image

@rikmarais
Copy link
Author

I think I figured it out.

We encountered another case with spaces in the path, however this time it was on Forge specifically
Game Data/Data/music/Soundboard
image

I checked the code and found why the issue was happening in Foundry when there are multiple spaces, too.

The problem is in soundboard.js line 692 and 778, where the returned target is matched to the configured Soundboard Custom Directory
image

Likely dependent on the OS running the Foundry Server, the target isn't always returned with URL escaped spaces. So doing a .replace(' ', '%20') won't always be necessary.

Similarly, .replace will only replace 1 instance of a space, which is why we ran into the problem on Foundry Local running on Windows as soon as more than one space appeared.

Maybe the thing to do is to do a double comparison for both Forge and Foundry local cases:
If the target with all spaces replaced matches the setting, OR the target with no spaces replaced matches the setting, proceed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant