Re-encode URLs from CF and when exporting to MR for RFC3986 compliance

This commit is contained in:
comp500
2022-02-14 15:48:54 +00:00
parent fa5de4b4bc
commit 36b6d806c8
3 changed files with 34 additions and 3 deletions

View File

@@ -135,6 +135,13 @@ var exportCmd = &cobra.Command{
serverEnv = envInstalled
}
// Modrinth URLs must be RFC3986
u, err := core.ReencodeURL(mod.Download.URL)
if err != nil {
fmt.Printf("Error re-encoding mod URL: %s\n", err.Error())
u = mod.Download.URL
}
manifestFiles[i] = PackFile{
Path: path,
Hashes: hashes,
@@ -142,7 +149,7 @@ var exportCmd = &cobra.Command{
Client string `json:"client"`
Server string `json:"server"`
}{Client: clientEnv, Server: serverEnv},
Downloads: []string{mod.Download.URL},
Downloads: []string{u},
}
}