forked from kevadesu/forgejo
Merge pull request '[GITEA] Fix API inconsistencies' (#2182) from gusted/forgejo-api-fixes into forgejo-dependency
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2182 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
This commit is contained in:
commit
c023e6d23f
5 changed files with 23 additions and 6 deletions
|
@ -545,5 +545,5 @@ func RenameUser(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
log.Trace("User name changed: %s -> %s", oldName, newName)
|
||||
ctx.Status(http.StatusOK)
|
||||
ctx.Status(http.StatusNoContent)
|
||||
}
|
||||
|
|
|
@ -256,7 +256,9 @@ func GetArchive(ctx *context.APIContext) {
|
|||
// ---
|
||||
// summary: Get an archive of a repository
|
||||
// produces:
|
||||
// - application/json
|
||||
// - application/octet-stream
|
||||
// - application/zip
|
||||
// - application/gzip
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
|
@ -337,7 +339,17 @@ func download(ctx *context.APIContext, archiveName string, archiver *repo_model.
|
|||
}
|
||||
defer fr.Close()
|
||||
|
||||
contentType := ""
|
||||
switch archiver.Type {
|
||||
case git.ZIP:
|
||||
contentType = "application/zip"
|
||||
case git.TARGZ:
|
||||
// Per RFC6713.
|
||||
contentType = "application/gzip"
|
||||
}
|
||||
|
||||
ctx.ServeContent(fr, &context.ServeHeaderOptions{
|
||||
ContentType: contentType,
|
||||
Filename: downloadName,
|
||||
LastModified: archiver.CreatedUnix.AsLocalTime(),
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue