moo-man / WFRP4e-FoundryVTT

The premiere system for running grim and perilous games of Warhammer Fantasy Role-play in the Foundry VTT environment.
Apache License 2.0
87 stars 52 forks source link

Upload disabled from ALL paths containing the words "systems" or "modules" anywhere #1434

Closed Ilysssa closed 1 year ago

Ilysssa commented 1 year ago

Describe the bug Unable to upload files to ANY path that has "systems" or "modules" in the name.

I host several games for me and my friends on a dedicated server with shared file storage between several foundry instances. We have a dedicated folder on the path "data/game-systems" which contains custom assets sorted by individual game-systems.

The WFRP system checks whether the path in the file picker contains the word "systems" or "modules" which prevents uploads to said path, including any subfolders located therein (See "utility-wfrp4e.js").

Hooks.on("renderFilePicker", (app, html, data) => {
  if (data.target.includes("systems") || data.target.includes("modules")) {
    html.find("input[name='upload']").css("display", "none")
    let label = html.find(".upload-file label")
    label.text("Upload Disabled");
    label.append(`<i data-tooltip="Upload disabled while in system directory. DO NOT put your assets within any system or module folder." style="display:inline-block; margin-left:5px;" class="fa-regular fa-circle-question"></i>`)
  }
})  

Suggested fix would be to check whether the target path starts with "systems" or "modules" (i.e, "^/systems" or "^/modules") instead of searching for the words "systems" or "modules" anywhere in the file path.

To Reproduce Create a folder which contains the name "systems" or "modules" on a different path from the default foundry "systems" and "modules" folders and attempt to upload a file.

Screenshots N/A

Version Numbers

Foundry: 10.290 wfrp4e: 6.3.1

moo-man commented 1 year ago

You should still be able to drag and drop assets to upload them

Ilysssa commented 1 year ago

You should still be able to drag and drop assets to upload them

Thanks brewski, I'll let my bro know about this workaround for now. Fix would still be appreciated though.