forked from hinterland/hearth
feat: vendor gitea 1.16.2
This commit is contained in:
@@ -198,6 +198,23 @@ func PackageVersionMetadata(ctx *context.Context) {
|
||||
}
|
||||
|
||||
metadata := pd.Metadata.(*swift_module.Metadata)
|
||||
repositoryURLs := make([]string, 0, len(pd.VersionProperties))
|
||||
for _, property := range pd.VersionProperties {
|
||||
if property.Name == swift_module.PropertyRepositoryURL {
|
||||
repositoryURLs = append(repositoryURLs, property.Value)
|
||||
}
|
||||
}
|
||||
|
||||
var author *swift_module.Person
|
||||
if metadata.Author.Name != "" || metadata.Author.GivenName != "" || metadata.Author.MiddleName != "" || metadata.Author.FamilyName != "" {
|
||||
author = &swift_module.Person{
|
||||
Type: "Person",
|
||||
Name: metadata.Author.Name,
|
||||
GivenName: metadata.Author.GivenName,
|
||||
MiddleName: metadata.Author.MiddleName,
|
||||
FamilyName: metadata.Author.FamilyName,
|
||||
}
|
||||
}
|
||||
|
||||
setResponseHeaders(ctx.Resp, &headers{})
|
||||
|
||||
@@ -220,18 +237,14 @@ func PackageVersionMetadata(ctx *context.Context) {
|
||||
Keywords: metadata.Keywords,
|
||||
CodeRepository: metadata.RepositoryURL,
|
||||
License: metadata.License,
|
||||
LicenseURL: metadata.LicenseURL,
|
||||
Author: author,
|
||||
ProgrammingLanguage: swift_module.ProgrammingLanguage{
|
||||
Type: "ComputerLanguage",
|
||||
Name: "Swift",
|
||||
URL: "https://swift.org",
|
||||
},
|
||||
Author: swift_module.Person{
|
||||
Type: "Person",
|
||||
Name: metadata.Author.String(),
|
||||
GivenName: metadata.Author.GivenName,
|
||||
MiddleName: metadata.Author.MiddleName,
|
||||
FamilyName: metadata.Author.FamilyName,
|
||||
},
|
||||
RepositoryURLs: repositoryURLs,
|
||||
},
|
||||
})
|
||||
}
|
||||
@@ -281,7 +294,7 @@ func DownloadManifest(ctx *context.Context) {
|
||||
filename = fmt.Sprintf("Package@swift-%s.swift", swiftVersion)
|
||||
}
|
||||
|
||||
ctx.ServeContent(strings.NewReader(m.Content), &context.ServeHeaderOptions{
|
||||
ctx.ServeContent(strings.NewReader(m.Content), context.ServeHeaderOptions{
|
||||
ContentType: "text/x-swift",
|
||||
Filename: filename,
|
||||
LastModified: pv.CreatedUnix.AsLocalTime(),
|
||||
@@ -300,7 +313,7 @@ func formFileOptionalReadCloser(ctx *context.Context, formKey string) (io.ReadCl
|
||||
|
||||
content := ctx.Req.FormValue(formKey)
|
||||
if content == "" {
|
||||
return nil, nil
|
||||
return nil, nil //nolint:nilnil // return nil to indicate that the content does not exist
|
||||
}
|
||||
return io.NopCloser(strings.NewReader(content)), nil
|
||||
}
|
||||
@@ -437,7 +450,7 @@ func DownloadPackageFile(ctx *context.Context) {
|
||||
Digest: pd.Files[0].Blob.HashSHA256,
|
||||
})
|
||||
|
||||
helper.ServePackageFile(ctx, s, u, pf, &context.ServeHeaderOptions{
|
||||
helper.ServePackageFile(ctx, s, u, pf, context.ServeHeaderOptions{
|
||||
Filename: pf.Name,
|
||||
ContentType: "application/zip",
|
||||
LastModified: pf.CreatedUnix.AsLocalTime(),
|
||||
|
||||
Reference in New Issue
Block a user