mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Add Content-Disposition header for downloads (#3439)
This commit is contained in:
		@@ -325,6 +325,7 @@ func runWeb(ctx *cli.Context) error {
 | 
			
		||||
			defer fr.Close()
 | 
			
		||||
 | 
			
		||||
			ctx.Header().Set("Cache-Control", "public,max-age=86400")
 | 
			
		||||
			ctx.Header().Set("Content-Disposition", fmt.Sprintf(`inline; filename="%s"`, attach.Name))
 | 
			
		||||
			// Fix #312. Attachments with , in their name are not handled correctly by Google Chrome.
 | 
			
		||||
			// We must put the name in " manually.
 | 
			
		||||
			if err = repo.ServeData(ctx, "\""+attach.Name+"\"", fr); err != nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user