Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions storage-s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (s *Storage) Info() plugin.Info {
}
}

func (s *Storage) UploadFile(ctx *plugin.GinContext, source plugin.UploadSource) (resp plugin.UploadFileResponse) {
func (s *Storage) UploadFile(ctx *plugin.GinContext, source plugin.UploadFileCondition) (resp plugin.UploadFileResponse) {
resp = plugin.UploadFileResponse{}

file, err := ctx.FormFile("file")
Expand All @@ -91,7 +91,7 @@ func (s *Storage) UploadFile(ctx *plugin.GinContext, source plugin.UploadSource)
return resp
}

if !s.checkFileType(file.Filename, source) {
if !s.checkFileType(file.Filename, condition.Source) {
resp.OriginalError = fmt.Errorf("file type not allowed")
resp.DisplayErrorMsg = plugin.MakeTranslator(i18n.ErrUnsupportedFileType)
return resp
Expand All @@ -111,7 +111,7 @@ func (s *Storage) UploadFile(ctx *plugin.GinContext, source plugin.UploadSource)
}
defer openFile.Close()

objectKey := s.createObjectKey(file.Filename, source)
objectKey := s.createObjectKey(file.Filename, condition.Source)
err = s.Client.PutObject(objectKey, strings.ToLower(filepath.Ext(file.Filename)), openFile)
if err != nil {
resp.OriginalError = fmt.Errorf("upload file failed: %v", err)
Expand Down