1
0

Remove all debugging calls.

This commit is contained in:
Alexander Andreev 2022-02-07 22:27:34 +04:00
parent be37f74317
commit 8a4104c3d5
Signed by: Arav
GPG Key ID: 1327FE8A374CC86F

View File

@ -133,16 +133,14 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
defer fDst.Close()
n, err := io.Copy(fDst, f) _, err = io.Copy(fDst, f)
if err != nil { if err != nil {
h.logErr.Println("failed to copy uploaded file to destination:", err) h.logErr.Println("failed to copy uploaded file to destination:", err)
w.WriteHeader(http.StatusInternalServerError) w.WriteHeader(http.StatusInternalServerError)
return return
} }
fmt.Println(n, err)
fDst.Sync()
fDst.Close()
h.logUpload.Printf("| %s | %s | %s | SHA256 %s | %s | %d", r.RemoteAddr, utils.NetworkType(r.Host), h.logUpload.Printf("| %s | %s | %s | SHA256 %s | %s | %d", r.RemoteAddr, utils.NetworkType(r.Host),
fHandler.Filename, fSha256, fSaltedHash, fHandler.Size) fHandler.Filename, fSha256, fSaltedHash, fHandler.Size)
@ -150,6 +148,7 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusCreated) w.WriteHeader(http.StatusCreated)
} else { } else {
os.Chtimes(fPath, time.Now(), time.Now()) os.Chtimes(fPath, time.Now(), time.Now())
w.WriteHeader(http.StatusFound)
} }
downloadURL := path.Join("/f", fSaltedHash, fHandler.Filename) downloadURL := path.Join("/f", fSaltedHash, fHandler.Filename)