forked from jason/cpolis
Only use fmt.Sprint() when necessary
This commit is contained in:
@ -547,7 +547,7 @@ func UploadArticleImage(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
||||
return
|
||||
}
|
||||
|
||||
url := fmt.Sprint(c.Domain, "/image/serve/", filename)
|
||||
url := c.Domain + "/image/serve/" + filename
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
json.NewEncoder(w).Encode(url)
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ func PublishLatestIssue(c *b.Config, db *b.DB, s *b.CookieStore) http.HandlerFun
|
||||
|
||||
article := &b.Article{
|
||||
Title: title,
|
||||
EncURL: fmt.Sprint(c.Domain, "/image/serve/", imgFileName),
|
||||
EncURL: c.Domain + "/image/serve/" + imgFileName,
|
||||
EncLength: int(imgInfo.Size()),
|
||||
EncType: mime.TypeByExtension(filepath.Ext(imgAbsName)),
|
||||
Published: true,
|
||||
|
@ -51,7 +51,7 @@ func UploadPDF(c *b.Config, s *b.CookieStore) http.HandlerFunc {
|
||||
}
|
||||
|
||||
filename := fmt.Sprint(uuid.New(), ".pdf")
|
||||
absFilepath, err := filepath.Abs(fmt.Sprint(c.PDFDir, "/", filename))
|
||||
absFilepath, err := filepath.Abs(c.PDFDir + "/" + filename)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
||||
|
Reference in New Issue
Block a user