mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-11-04 12:53:43 +01:00 
			
		
		
		
	Set utf-8 charset for text files when serving raw content (#2898)
This commit is contained in:
		
							parent
							
								
									b3c05026df
								
							
						
					
					
						commit
						39356f4238
					
				@ -29,7 +29,7 @@ func ServeData(ctx *context.Context, name string, reader io.Reader) error {
 | 
			
		||||
			ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		ctx.Resp.Header().Set("Content-Type", "text/plain")
 | 
			
		||||
		ctx.Resp.Header().Set("Content-Type", "text/plain; charset=utf-8")
 | 
			
		||||
	}
 | 
			
		||||
	ctx.Resp.Write(buf)
 | 
			
		||||
	_, err := io.Copy(ctx.Resp, reader)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user