| func crmAttachmentHandler(w http.ResponseWriter, r *http.Request) { | func crmAttachmentHandler(w http.ResponseWriter, r *http.Request) { | ||||
| fileID := getCrmFileID(r.URL.Path) | fileID := getCrmFileID(r.URL.Path) | ||||
| saveAs := GlobalPath.CRMAttachment + "crm_attach_" + fileID //add prefix for easy deleting | saveAs := GlobalPath.CRMAttachment + "crm_attach_" + fileID //add prefix for easy deleting | ||||
| if isFileExist(saveAs) { | |||||
| http.ServeFile(w, r, saveAs) | |||||
| return | |||||
| } | |||||
| if fileID == "" { | if fileID == "" { | ||||
| log.Println("invalid fileID") | log.Println("invalid fileID") | ||||
| response404Handler(w) | response404Handler(w) |