From 983c8273e87b828844d4beee31263049b9060496 Mon Sep 17 00:00:00 2001 From: Patrick Peng Sun Date: Thu, 13 Jul 2017 00:43:25 +1000 Subject: [PATCH] bugfix : after downloadingfile ,we still need to serve it.. --- crmcache.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crmcache.go b/crmcache.go index 71cf530..b7c2e50 100644 --- a/crmcache.go +++ b/crmcache.go @@ -7,7 +7,7 @@ import ( ) func crmcache(w http.ResponseWriter, r *http.Request) { - debugDumpHTTPRequest(r) + //debugDumpHTTPRequest(r) if !checkSignatureByToken(r, IntraAPIConfig.CRMSecrete) { w.WriteHeader(http.StatusUnauthorized) fmt.Fprintf(w, "Expired or invalid link") @@ -38,8 +38,12 @@ func crmcache(w http.ResponseWriter, r *http.Request) { if err != nil { w.WriteHeader(http.StatusNotFound) fmt.Fprintf(w, "reference number is not right") + return + } + if isFileExist(path) { + http.ServeFile(w, r, path) + return } - w.WriteHeader(http.StatusInternalServerError) fmt.Fprintf(w, "cannot build reference cache") }