turms icon indicating copy to clipboard operation
turms copied to clipboard

minio 403

Open Piscen opened this issue 1 year ago • 1 comments

通过client.storageService.uploadUserProfilePicture上传时能正常上传文件,client.storageService.uploadMessageAttachmentInPrivateConversation返回403

Piscen avatar Feb 27 '24 03:02 Piscen

在flutter客户端sdk中,我上传的消息图片,这一段设置了Content-Type,但其实不能传这个type if (mediaType != null) { request.fields['Content-Type'] = mediaType.toString(); }

因为服务端默认MessageAttachment允许的上传类型为”/“,获取上传参数没有调用addStartsWithCondition(”Content-Type“,导致的403

头像上传默认是“image/*”才没有这个问题

Piscen avatar Feb 27 '24 08:02 Piscen

通过client.storageService.uploadUserProfilePicture上传时能正常上传文件,client.storageService.uploadMessageAttachmentInPrivateConversation返回403

我用client.storageService.uploadUserProfilePicture的时候,一直是403 参数都能获取到,但是上传不了,参数示例如下 uri:http://localhost:9000/user-profile-picture x-amz-date:20240412T060645Z x-amz-signature:545fcd84eac9447574832351c5b0266ad403d18135aa2412eed1dca83c27630a x-amz-algorithm:AWS4-HMAC-SHA256 x-amz-credential:minioadmin/20240412/us-east-1/s3/aws4_request policy:eyJleHBpcmF0aW9uIjoiMjAyNC0wNC0xMlQwNjoxMTo0NS4yMTNaIiwiY29uZGl0aW9ucyI6W1siZXEiLCIkYnVja2V0IiwidXNlci1wcm9maWxlLXBpY3R1cmUiXSxbImVxIiwiJGtleSIsIjEiXSxbInN0YXJ0cy13aXRoIiwiJENvbnRlbnQtVHlwZSIsImltYWdlLyJdLFsiY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMTA0ODU3Nl0sWyJlcSIsIiR4LWFtei1hbGdvcml0aG0iLCJBV1M0LUhNQUMtU0hBMjU2Il0sWyJlcSIsIiR4LWFtei1jcmVkZW50aWFsIiwibWluaW9hZG1pbi8yMDI0MDQxMi91cy1lYXN0LTEvczMvYXdzNF9yZXF1ZXN0Il0sWyJlcSIsIiR4LWFtei1kYXRlIiwiMjAyNDA0MTJUMDYwNjQ1WiJdXX0= key:1 大佬你是怎么解决的?

water2060 avatar Apr 12 '24 06:04 water2060

Thanks for reporting.

I have updated the latest turms-plugin-minio plugin. It now always requires users to pass the Content-Type header so that the clients don't need to decide whether passing the Content-Type is allowed and should always pass the header, which makes the feature easier to use correctly.

You can download the latest turms-plugin-minio without the need to upgrade Turms servers.

If you are interested in the implementation, it is quite easy: https://github.com/turms-im/turms/commit/06649b6fe3e68966a956ff86d0f51e2502bc394d

JamesChenX avatar Apr 12 '24 22:04 JamesChenX