Przeglądaj źródła

bugfix : after downloadingfile ,we still need to serve it..

master
Patrick Peng Sun 8 lat temu
rodzic
commit
983c8273e8
1 zmienionych plików z 6 dodań i 2 usunięć
  1. +6
    -2
      crmcache.go

+ 6
- 2
crmcache.go Wyświetl plik

) )


func crmcache(w http.ResponseWriter, r *http.Request) { func crmcache(w http.ResponseWriter, r *http.Request) {
debugDumpHTTPRequest(r)
//debugDumpHTTPRequest(r)
if !checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) { if !checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) {
w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
fmt.Fprintf(w, "Expired or invalid link") fmt.Fprintf(w, "Expired or invalid link")
if err != nil { if err != nil {
w.WriteHeader(http.StatusNotFound) w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "reference number is not right") fmt.Fprintf(w, "reference number is not right")
return
}
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")
} }

Ładowanie…
Anuluj
Zapisz