Update oss_service.go
This commit is contained in:
@@ -207,9 +207,7 @@ func (s *s3OSS) PublicURL(objectKey string) string {
|
|||||||
func (s *s3OSS) UploadFile(objectKey, filePath string) error {
|
func (s *s3OSS) UploadFile(objectKey, filePath string) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
_, err := s.client.FPutObject(ctx, s.bucketName, objectKey, filePath, minio.PutObjectOptions{
|
_, err := s.client.FPutObject(ctx, s.bucketName, objectKey, filePath, minio.PutObjectOptions{
|
||||||
UserMetadata: map[string]string{
|
ContentDisposition: "attachment",
|
||||||
"Content-Disposition": "attachment",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("error subiendo archivo a S3: %w", err)
|
return fmt.Errorf("error subiendo archivo a S3: %w", err)
|
||||||
@@ -285,9 +283,7 @@ func (s *s3OSS) SignedURL(objectKey string, expireSeconds int) (string, error) {
|
|||||||
func (s *s3OSS) UploadFromReader(objectKey, contentType string, r io.Reader) error {
|
func (s *s3OSS) UploadFromReader(objectKey, contentType string, r io.Reader) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
opts := minio.PutObjectOptions{
|
opts := minio.PutObjectOptions{
|
||||||
UserMetadata: map[string]string{
|
ContentDisposition: "attachment",
|
||||||
"Content-Disposition": "attachment",
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
if contentType != "" {
|
if contentType != "" {
|
||||||
opts.ContentType = contentType
|
opts.ContentType = contentType
|
||||||
|
|||||||
Reference in New Issue
Block a user