credomane / FactorioMods_FactorioMaps

Jeroon's Factorio Maps mod
http://www.factorioforums.com/14582
47 stars 7 forks source link

"FILE_NOT_FOUND" Error in all browsers #4

Closed PiggyWhiskey closed 7 years ago

PiggyWhiskey commented 7 years ago

Using Factorio 0.14.19 Mod version 0.7.2

Settings: Day, Show Entity Folder Name : "BobsMods" Size: -1024x-1024 to 1024x1024 jpeg Medium grid size.

Generated 5461 images for 256 MB.

Opening in any browser and works fine, but the moment I drag or zoom, it crashes with "FILE_NOT_FOUND"

Testing in Chrome,Firefox,Internet Explorer,Edge.

Any advice?

PiggyWhiskey commented 7 years ago

Discovered the issue.

The local URL was "E:\Program Files\steam\steamapps\common\factorio\script-output\FactorioMaps\BobsMods\"

The space in Program Files is causing the problem.

Running directly from "E:\BobsMods" works perfectly.

RossBarnie commented 7 years ago

Came across this too. For whatever reason when you zoom or move, the URL changes any spaces to %2520 rather than %20, so the file couldn't be found as it's not looking in the correct directory.

EDIT: Found the offending line: https://github.com/credomane/FactorioMods_FactorioMaps/blob/master/fm/generateIndex.lua#L67. Does the url need to be encoded here? If the index is in a folder containing a space character and I open it in a browser, the spaces are encoded as %20 already, so encoding it again, according to this http://stackoverflow.com/questions/16084935/a-html-space-is-showing-as-2520-instead-of-20, causes the %20 to then be encoded. %25 is the % character and 20 doesn't need to be encoded. So the generated URL would be looking for "path/to/broken/folder/broken%20copy/index.html" on your file system.

credomane commented 7 years ago

Sorry for the long wait. Life had me torn away from Factorio for the past 6ish months. I'm sorta/mostly back!

Most of the index.html code is left overs from the original author of this mod. The mod isn't generating or getting the URI from the user but is updating the already valid one thereby rendering the use of encodeURI moot. I don't know why encodeURI would be needed at all. I'll fix this up plus the other issues inside the index.html generating code and give the whole generateIndex.lua a good once over sometime this week.