Преглед изворни кода

bug fix , serve existing file before download...

master
Patrick Peng Sun пре 8 година
родитељ
комит
d5bba6b4e1
1 измењених фајлова са 4 додато и 5 уклоњено
  1. +4
    -5
      crmcache.go

+ 4
- 5
crmcache.go Прегледај датотеку

id := attachmentid[0] id := attachmentid[0]
path := crmcacheFileName(id) path := crmcacheFileName(id)


if isFileExist(path) {
http.ServeFile(w, r, path)
return
}
err = crmDownloadAttachmentAs(id, path) err = crmDownloadAttachmentAs(id, path)


if err != nil { if err != nil {
fmt.Fprintf(w, "reference number is not right") fmt.Fprintf(w, "reference number is not right")
} }


if isFileExist(path) {
http.ServeFile(w, r, path)
return
}

w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
fmt.Fprintf(w, "cannot build reference cache") fmt.Fprintf(w, "cannot build reference cache")
} }

Loading…
Откажи
Сачувај