Skip to content

Commit 53a4156

Browse files
author
Louis Bettens
committed
upload: don't explicitly set Content-Length
`net/http` does it automatically. Fixes #1
1 parent 70f6763 commit 53a4156

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

cmd/upload.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"os"
1818
"math/rand"
1919
"strings"
20-
"strconv"
2120
gs "github.com/R4yGM/garlicshare/size"
2221
)
2322

@@ -364,10 +363,6 @@ func Upload(){
364363
} else {
365364
w.Header().Set("Content-Disposition", "attachment; filename="+path)
366365
w.Header().Set("Content-Type", "application/octet-stream")
367-
fi, err := os.Stat(path)
368-
if err != nil {
369-
}
370-
w.Header().Set("Content-Lenght", strconv.FormatInt(int64(fi.Size()), 10))
371366
http.ServeFile(w, r, path)
372367
}
373368
}else{
@@ -383,10 +378,6 @@ func Upload(){
383378
} else {
384379
w.Header().Set("Content-Disposition", "attachment; filename="+path)
385380
w.Header().Set("Content-Type", "application/octet-stream")
386-
fi, err := os.Stat(path)
387-
if err != nil {
388-
}
389-
w.Header().Set("Content-Lenght", strconv.FormatInt(int64(fi.Size()), 10))
390381
http.ServeFile(w, r, path)
391382
}
392383
}

0 commit comments

Comments
 (0)