You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@answer.apache.org by li...@apache.org on 2025/02/24 07:34:46 UTC

(answer-plugins) branch main updated: storage-s3 wrong signature

This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/answer-plugins.git


The following commit(s) were added to refs/heads/main by this push:
     new d71a61c  storage-s3 wrong signature
d71a61c is described below

commit d71a61cb921b4a149ebe3dc10a19c4a26672c4c4
Author: codewec <bz...@gmail.com>
AuthorDate: Mon Feb 24 12:20:26 2025 +0500

    storage-s3 wrong signature
    
    The plugin could not be registered
---
 storage-s3/s3.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/storage-s3/s3.go b/storage-s3/s3.go
index 7163b94..2cf2976 100644
--- a/storage-s3/s3.go
+++ b/storage-s3/s3.go
@@ -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")
@@ -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
@@ -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)