From ac4b8800cbd6f845986b3cc3c03d7f1cdb1ee298 Mon Sep 17 00:00:00 2001 From: Gaspare Iengo Date: Thu, 15 Oct 2020 21:02:31 +0000 Subject: [PATCH] Removed detectMimeType --- docker/Dockerfile.go_build | 1 + weed/command/filer_copy.go | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docker/Dockerfile.go_build b/docker/Dockerfile.go_build index ea0a57769..2a5fcb287 100644 --- a/docker/Dockerfile.go_build +++ b/docker/Dockerfile.go_build @@ -1,6 +1,7 @@ FROM frolvlad/alpine-glibc as builder RUN apk add git go g++ RUN mkdir -p /go/src/github.com/chrislusf/ +ADD https://api.github.com/repos/Dando-Real-ITA/seaweedfs/git/refs/heads/develop version.json RUN git clone --depth 1 https://github.com/Dando-Real-ITA/seaweedfs -b develop /go/src/github.com/chrislusf/seaweedfs RUN cd /go/src/github.com/chrislusf/seaweedfs/weed && go install diff --git a/weed/command/filer_copy.go b/weed/command/filer_copy.go index 600f4028f..03680e81b 100644 --- a/weed/command/filer_copy.go +++ b/weed/command/filer_copy.go @@ -277,7 +277,8 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err // upload the file content fileName := filepath.Base(f.Name()) - mimeType := detectMimeType(f) + // mimeType := detectMimeType(f) + mimeType := "application/octet-stream" data, err := ioutil.ReadAll(f) if err != nil { return err @@ -364,7 +365,8 @@ func (worker *FileCopyWorker) uploadFileAsOne(task FileCopyTask, f *os.File) err func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File, chunkCount int, chunkSize int64) error { fileName := filepath.Base(f.Name()) - mimeType := detectMimeType(f) + // mimeType := detectMimeType(f) + mimeType := "application/octet-stream" chunksChan := make(chan *filer_pb.FileChunk, chunkCount) @@ -486,7 +488,7 @@ func (worker *FileCopyWorker) uploadFileInChunks(task FileCopyTask, f *os.File, func detectMimeType(f *os.File) string { head := make([]byte, 512) f.Seek(0, io.SeekStart) - n, err := f.Read(head) + _, err := f.Read(head) if err == io.EOF { return "" }