From 9c62999fba4874462ecc5e0b9ccef49227fa95d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20H=C3=BCbner?= Date: Fri, 8 Sep 2023 17:17:40 +0200 Subject: [PATCH] path separator fix --- modrinth/mrpack/index.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modrinth/mrpack/index.go b/modrinth/mrpack/index.go index 161cf01..0df935a 100644 --- a/modrinth/mrpack/index.go +++ b/modrinth/mrpack/index.go @@ -7,6 +7,8 @@ import ( "fmt" "github.com/nothub/mrpack-install/web/download" "io" + "log" + "strings" ) import modrinth "github.com/nothub/mrpack-install/modrinth/api" @@ -98,6 +100,14 @@ func ReadIndex(zipFile string) (*Index, error) { return nil, err } + // https://github.com/modrinth/docs/issues/85 ¯\_(ツ)_/¯ + for i, file := range index.Files { + if strings.Contains(file.Path, "\\") { + index.Files[i].Path = strings.ReplaceAll(file.Path, "\\", "/") + log.Printf("fixed file path: old=%q new=%q\n", file.Path, index.Files[i].Path) + } + } + return &index, nil }