nothub / mrpack-install

Modrinth Modpack server deployment
https://pkg.go.dev/github.com/nothub/mrpack-install
MIT License
128 stars 9 forks source link

"File path is not safe" #49

Closed zhongjiedong closed 2 months ago

zhongjiedong commented 2 months ago

v0.17.2-beta

c:\MCServers>mrpack-install "c:\MCServers\mrpacks\Prominence II [RPG] 2.8.4.mrpack" Installing "Prominence II [RPG]" from "c:\\MCServers\\mrpacks\\Prominence II [RPG] 2.8.4.mrpack" to "c:\\MCServers\\mc" File path is not safe: c:\MCServers\mc\mods\do-a-barrel-roll-3.3.7+1.20-fabric.jar

Nothing is created at all so it seems to be failing in the first step

zhongjiedong commented 2 months ago

something to do with the double \ ?

nothub commented 2 months ago

I just tried to reproduce the issue but I am unable to recreate the problem.

image

I tested both, the current stable (v0.16.10) and the latest beta (v0.17.2).

The commands i executed were: mrpack-install-0.16.10.exe "C:\Users\Hub\MCServers\mrpacks\Prominence II [RPG] 2.8.4.mrpack" and mrpack-install-0.17.2-beta.exe "C:\Users\Hub\MCServers\mrpacks\Prominence II [RPG] 2.8.4.mrpack"

Is the mrpack file you use the unchanged original from modrinth?

zhongjiedong commented 2 months ago

yep I downloaded from modrinth, specifically the prominence II pack. Can you try and let me know if it works?

nothub commented 2 months ago

Can you try and let me know if it works?

I tried again and I found the issue.

Windows seems to ignore the case of the drive, e.g. c:\MCServers and C:\MCServers point to the same location. This causes a bug somewhere in the path validation.

For now, make sure your working directory is C:\MCServers and not c:\MCServers to circumvent the problem.

I gonna test a few ways to approach this issue.

image

nothub commented 2 months ago

I created a new release v0.17.3-beta which solves the problem for me. @zhongjiedong can you verify that the new version also fixes the problem on your side?

zhongjiedong commented 2 months ago

Fixed the issue, thanks so much!

nothub commented 2 months ago

Awesome :smiley: Thank you for reporting the issue!