mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2020-11-18 19:53:40 -08:00
Fix linting errors
This commit is contained in:
parent
a3fe3feafa
commit
d0dbdd3591
@ -60,8 +60,8 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
html_templates = initHTMLTemplates()
|
||||
text_templates = initTextTemplates()
|
||||
htmlTemplates = initHTMLTemplates()
|
||||
textTemplates = initTextTemplates()
|
||||
)
|
||||
|
||||
func stripPrefix(path string) string {
|
||||
@ -160,7 +160,7 @@ func (s *Server) previewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
contentLength,
|
||||
}
|
||||
|
||||
if err := html_templates.ExecuteTemplate(w, templatePath, data); err != nil {
|
||||
if err := htmlTemplates.ExecuteTemplate(w, templatePath, data); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
@ -174,12 +174,12 @@ func (s *Server) viewHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// vars := mux.Vars(r)
|
||||
|
||||
if acceptsHTML(r.Header) {
|
||||
if err := html_templates.ExecuteTemplate(w, "index.html", nil); err != nil {
|
||||
if err := htmlTemplates.ExecuteTemplate(w, "index.html", nil); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
if err := text_templates.ExecuteTemplate(w, "index.txt", nil); err != nil {
|
||||
if err := textTemplates.ExecuteTemplate(w, "index.txt", nil); err != nil {
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
@ -220,8 +220,8 @@ func (s *Server) Run() {
|
||||
|
||||
fs = http.Dir(s.webPath)
|
||||
|
||||
html_templates, _ = html_templates.ParseGlob(s.webPath + "*.html")
|
||||
text_templates, _ = text_templates.ParseGlob(s.webPath + "*.txt")
|
||||
htmlTemplates, _ = htmlTemplates.ParseGlob(s.webPath + "*.html")
|
||||
textTemplates, _ = textTemplates.ParseGlob(s.webPath + "*.txt")
|
||||
} else {
|
||||
fs = &assetfs.AssetFS{
|
||||
Asset: web.Asset,
|
||||
@ -238,8 +238,8 @@ func (s *Server) Run() {
|
||||
log.Panicf("Unable to parse: path=%s, err=%s", path, err)
|
||||
}
|
||||
|
||||
html_templates.New(stripPrefix(path)).Parse(string(bytes))
|
||||
text_templates.New(stripPrefix(path)).Parse(string(bytes))
|
||||
htmlTemplates.New(stripPrefix(path)).Parse(string(bytes))
|
||||
textTemplates.New(stripPrefix(path)).Parse(string(bytes))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user