1
1
mirror of https://github.com/go-gitea/gitea synced 2025-09-28 03:28:13 +00:00

Add ETag header to avatars (#721)

This commit is contained in:
Bwko
2017-01-25 05:26:31 +01:00
committed by Lunny Xiao
parent 8093b3372e
commit 8555e888d8
7 changed files with 50 additions and 9 deletions

11
vendor/gopkg.in/macaron.v1/render.go generated vendored
View File

@@ -21,6 +21,7 @@ import (
"encoding/xml"
"fmt"
"html/template"
"io"
"io/ioutil"
"net/http"
"os"
@@ -72,6 +73,7 @@ type (
// TemplateFileSystem represents a interface of template file system that able to list all files.
TemplateFileSystem interface {
ListFiles() []TemplateFile
Get(string) (io.Reader, error)
}
// Delims represents a set of Left and Right delimiters for HTML template rendering
@@ -246,6 +248,15 @@ func (fs TplFileSystem) ListFiles() []TemplateFile {
return fs.files
}
func (fs TplFileSystem) Get(name string) (io.Reader, error) {
for i := range fs.files {
if fs.files[i].Name()+fs.files[i].Ext() == name {
return bytes.NewReader(fs.files[i].Data()), nil
}
}
return nil, fmt.Errorf("file '%s' not found", name)
}
func PrepareCharset(charset string) string {
if len(charset) != 0 {
return "; charset=" + charset