diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-07 11:08:57 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-07 11:08:57 -0800 |
| commit | 9228ff192cb5c28833cfd4c3a9bb7828924425ee (patch) | |
| tree | 4d403536940eb59ec126917a34d4de7b6232308a /weed | |
| parent | 0375ce2c2e77c2529569e8d5289f54434be09348 (diff) | |
| download | seaweedfs-9228ff192cb5c28833cfd4c3a9bb7828924425ee.tar.xz seaweedfs-9228ff192cb5c28833cfd4c3a9bb7828924425ee.zip | |
encryption works
Diffstat (limited to 'weed')
| -rw-r--r-- | weed/operation/upload_content.go | 2 | ||||
| -rw-r--r-- | weed/server/filer_server_handlers_write_cipher.go | 8 |
2 files changed, 2 insertions, 8 deletions
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.go index a6dde973f..0ea39e306 100644 --- a/weed/operation/upload_content.go +++ b/weed/operation/upload_content.go @@ -62,7 +62,7 @@ func doUpload(uploadUrl string, filename string, cipher bool, reader io.Reader, contentIsGzipped := isGzipped shouldGzipNow := false if !isGzipped { - if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); iAmSure && shouldBeZipped { + if shouldBeZipped, iAmSure := util.IsGzippableFileType(filepath.Base(filename), mtype); mtype == "" || iAmSure && shouldBeZipped { shouldGzipNow = true contentIsGzipped = true } diff --git a/weed/server/filer_server_handlers_write_cipher.go b/weed/server/filer_server_handlers_write_cipher.go index e65915971..bd2b52fb3 100644 --- a/weed/server/filer_server_handlers_write_cipher.go +++ b/weed/server/filer_server_handlers_write_cipher.go @@ -33,21 +33,15 @@ func (fs *FilerServer) encrypt(ctx context.Context, w http.ResponseWriter, r *ht sizeLimit := int64(fs.option.MaxMB) * 1024 * 1024 pu, err := needle.ParseUpload(r, sizeLimit) - data := pu.Data uncompressedData := pu.Data - cipherKey := util.GenCipherKey() if pu.IsGzipped { uncompressedData = pu.UncompressedData - data, err = util.Encrypt(pu.UncompressedData, cipherKey) - if err != nil { - return nil, fmt.Errorf("encrypt input: %v", err) - } } if pu.MimeType == "" { pu.MimeType = http.DetectContentType(uncompressedData) } - uploadResult, uploadError := operation.Upload(urlLocation, pu.FileName, true, bytes.NewReader(data), pu.IsGzipped, "", pu.PairMap, auth) + uploadResult, uploadError := operation.Upload(urlLocation, pu.FileName, true, bytes.NewReader(uncompressedData), false, pu.MimeType, pu.PairMap, auth) if uploadError != nil { return nil, fmt.Errorf("upload to volume server: %v", uploadError) } |
