mirror of
https://github.com/packwiz/packwiz.git
synced 2025-10-22 09:14:31 +02:00
Merge branch 'main' into pr/unascribed/258
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"golang.org/x/exp/slices"
|
||||
"net/url"
|
||||
"os"
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/packwiz/packwiz/core"
|
||||
@@ -172,6 +173,10 @@ var exportCmd = &cobra.Command{
|
||||
}
|
||||
}
|
||||
}
|
||||
// sort by `path` property before serialising to ensure reproducibility
|
||||
sort.Slice(manifestFiles, func(i, j int) bool {
|
||||
return manifestFiles[i].Path < manifestFiles[j].Path
|
||||
})
|
||||
|
||||
err = session.SaveIndex()
|
||||
if err != nil {
|
||||
|
@@ -186,7 +186,7 @@ func getProjectTypeFolder(projectType string, fileLoaders []string, packLoaders
|
||||
|
||||
var urlRegexes = [...]*regexp.Regexp{
|
||||
// Slug/version number regex from https://github.com/modrinth/labrinth/blob/1679a3f844497d756d0cf272c5374a5236eabd42/src/util/validate.rs#L8
|
||||
regexp.MustCompile("^https?://modrinth\\.com/(?P<urlCategory>[^/]+)/(?P<slug>[a-zA-Z0-9!@$()`.+,_\"-]{3,64})(?:/version/(?P<version>[a-zA-Z0-9!@$()`.+,_\"-]{1,32}))?"),
|
||||
regexp.MustCompile("^https?://(www.)?modrinth\\.com/(?P<urlCategory>[^/]+)/(?P<slug>[a-zA-Z0-9!@$()`.+,_\"-]{3,64})(?:/version/(?P<version>[a-zA-Z0-9!@$()`.+,_\"-]{1,32}))?"),
|
||||
// Version/project IDs are more restrictive: [a-zA-Z0-9]+ (base62)
|
||||
regexp.MustCompile("^https?://cdn\\.modrinth\\.com/data/(?P<slug>[a-zA-Z0-9]+)/versions/(?P<versionID>[a-zA-Z0-9]+)/(?P<filename>[^/]+)$"),
|
||||
regexp.MustCompile("^(?P<slug>[a-zA-Z0-9!@$()`.+,_\"-]{3,64})$"),
|
||||
|
Reference in New Issue
Block a user