Git Product home page Git Product logo

minio-dart's Introduction

MinIO Dart

This is the unofficial MinIO Dart Client SDK that provides simple APIs to access any Amazon S3 compatible object storage server.

API

Bucket operations Object operations Presigned operations Bucket Policy & Notification operations
makeBucket getObject presignedUrl getBucketNotification
listBuckets getPartialObject presignedGetObject setBucketNotification
bucketExists fGetObject presignedPutObject removeAllBucketNotification
removeBucket putObject presignedPostPolicy listenBucketNotification
listObjects fPutObject getBucketPolicy
listObjectsV2 copyObject setBucketPolicy
listIncompleteUploads statObject
listAllObjects removeObject
listAllObjectsV2 removeObjects
removeIncompleteUpload

Usage

Initialize MinIO Client

MinIO

final minio = Minio(
  endPoint: 'play.min.io',
  accessKey: 'Q3AM3UQ867SPQQA43P2F',
  secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
);

AWS S3

final minio = Minio(
  endPoint: 's3.amazonaws.com',
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY',
);

Filebase

final minio = Minio(
  endPoint: 's3.filebase.com',
  accessKey: 'YOUR-ACCESSKEYID',
  secretKey: 'YOUR-SECRETACCESSKEY',
  useSSL: true,
);

File upload

import 'package:minio/io.dart';
import 'package:minio/minio.dart';

void main() async {
  final minio = Minio(
    endPoint: 'play.min.io',
    accessKey: 'Q3AM3UQ867SPQQA43P2F',
    secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
  );

  await minio.fPutObject('mybucket', 'myobject', 'path/to/file');
}

For complete example, see: example

To use fPutObject() and fGetObject, you have to import 'package:minio/io.dart';

Upload with progress

import 'package:minio/minio.dart';

void main() async {
  final minio = Minio(
    endPoint: 'play.min.io',
    accessKey: 'Q3AM3UQ867SPQQA43P2F',
    secretKey: 'zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG',
  );

  await minio.putObject(
    'mybucket', 
    'myobject', 
    Stream<Uint8List>.value(Uint8List(1024)),
    onProgress: (bytes) => print('$bytes uploaded'),
  );
}

Get object

import 'dart:io';
import 'package:minio/minio.dart';

void main() async {
  final minio = Minio(
    endPoint: 's3.amazonaws.com',
    accessKey: 'YOUR-ACCESSKEYID',
    secretKey: 'YOUR-SECRETACCESSKEY',
  );

  final stream = await minio.getObject('BUCKET-NAME', 'OBJECT-NAME');

  // Get object length
  print(stream.contentLength);

  // Write object data stream to file
  await stream.pipe(File('output.txt').openWrite());
}

Features and bugs

Please file feature requests and bugs at the issue tracker.

Contributions to this repository are welcome.

License

MIT

minio-dart's People

Contributors

hlacikd avatar ivoryxiong avatar philenius avatar rtgnx avatar vadympinchuk avatar xtyxtyx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

minio-dart's Issues

Progess callback

How I can get the progress of upload / get object from server?

Null safety update ?

Just wondering if an update of null safety version of the package is likely ?
I can get a list of minio buckets and objects with current package, but not put/get an object.
I'm not clear why, but I think it is because of null safety issues.
1.3 doesn't work with my other null-safty packages and dependencies and 2.0 pre-release doesn't deliver all working functions.
Just hoping !

How to upload multiple files to s3 bucket?

I am using Minio for uploading files into S3 bucket, I am uploading only single file, but now I want to upload multiple files but there is no such method defined in this package.

HandshakeException: Handshake error in client (OS Error: WRONG_VERSION_NUMBER(tls_record.cc:242))

I had this working, but I think something got updated either in this package or on the server I am uploading to, I am using filebase.com as my content provider, it uses S3 just like amazon and it was working about a month or so ago. I tried turning off SSL which made the error go away but the file itself did not upload to the server.

     final minio = Minio(
        endPoint: 's3.filebase.com',
        accessKey: 'REMOVED',
        secretKey: 'REMOVED',
        region: 'us-east-1',
  
      );
      var fileresult;
      try {
        fileresult = await minio.fPutObject('nimapp', filename, file.path);
      } catch (exception) {
        print(exception.toString());
        return systemMsgBad(exception.toString());
      }

Example on Flutter Web uploading image

Can someone show an example of how to use Minio in Flutter Web ?
I am new and cannot find any example on it.
My goal is straight forward. In Flutter Web, pick an image with ImagePicker and upload to S3.
Thanks and appreciate for any expert assistance.

minio.bucketExists is true although bucket doesn't exist

This is a part of my code:

final bool exists = await minio.bucketExists(userBucket); print('bucket exists: $exists'); if (!exists) { await minio.makeBucket(userBucket); } await minio.putObject(

exists is true in this case and therefore when calling putObject this error gets thrown:

[ +138 ms] [ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: MinioError: The specified bucket does not exist [ ] #0 validate (package:minio/src/minio_helpers.dart:222:5) [ ] #1 MinioUploader.upload (package:minio/src/minio_uploader.dart:112:5) [ ] <asynchronous suspension> [ ] #2 MinioUploader.addStream (package:minio/src/minio_uploader.dart:48:27) [ ] <asynchronous suspension> [ ] #3 Stream.pipe (dart:async/stream.dart:740:27) [ ] #4 Minio.putObject (package:minio/src/minio.dart:832:48)

Nullsafety version

Hi !

I thought I would give a shot at turning this package to null safety but it was quickly over my head. Especially the minio_models_generated.dart file. Sorry. In any case, it'd be great if this library could support null safety.

Thank you for library

Trying to upload file in s3 bucket using putObject

Am trying to upload document in aws s3 bucket using putObject await minio.putObject(bucketname,"path",data,
onProgress: (bytes){
print('uploaded');
}
);

But getting the error below, anyone can help me with it

Error: Unexpected null value.
at Object.throw_ [as throw] (http://localhost:53529/dart_sdk.js:5067:11)
at Object.nullCheck (http://localhost:53529/dart_sdk.js:5394:30)
at minio_client.MinioClient.new.getRequestUrl (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1056:44)
at minio_client.MinioClient.new.getBaseRequest (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1044:22)
at minio_client.MinioClient.new._request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:999:28)
at _request.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio_client.MinioClient.new.[_request] (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:994:20)
at minio_client.MinioClient.new.request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1022:43)
at request.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio_client.MinioClient.new.request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1021:20)
at minio$.Minio.new.getBucketRegion (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:2233:41)
at getBucketRegion.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio$.Minio.new.getBucketRegion (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:2225:20)
at minio_client.MinioClient.new._request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:996:55)
at _request.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio_client.MinioClient.new.[_request] (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:994:20)
at minio_client.MinioClient.new.request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1022:43)
at request.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio_client.MinioClient.new.request (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:1021:20)
at minio_uploader.MinioUploader.new._uploadChunk (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:293:39)
at _uploadChunk.next ()
at runBody (http://localhost:53529/dart_sdk.js:40590:34)
at Object._async [as async] (http://localhost:53529/dart_sdk.js:40621:7)
at minio_uploader.MinioUploader.new.[_uploadChunk] (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:292:20)
at minio_uploader.MinioUploader.new.addStream (http://localhost:53529/packages/minio/src/minio_uploader.dart.lib.js:246:56)
at addStream.next ()
at http://localhost:53529/dart_sdk.js:40571:33
at _RootZone.runUnary (http://localhost:53529/dart_sdk.js:40441:59)
at _FutureListener.thenAwait.handleValue (http://localhost:53529/dart_sdk.js:35363:29)
at handleValueCallback (http://localhost:53529/dart_sdk.js:35931:49)
at Function._propagateToListeners (http://localhost:53529/dart_sdk.js:35969:17)
at _Future.new.[_complete] (http://localhost:53529/dart_sdk.js:35809:25)
at _StreamIterator.new.[_onData] (http://localhost:53529/dart_sdk.js:37895:34)
at _RootZone.runUnaryGuarded (http://localhost:53529/dart_sdk.js:40378:11)
at _ControllerSubscription.new.[_sendData] (http://localhost:53529/dart_sdk.js:33906:22)
at _DelayedData.new.perform (http://localhost:53529/dart_sdk.js:37377:28)
at _StreamImplEvents.new.handleNext (http://localhost:53529/dart_sdk.js:37487:15)
at async._AsyncCallbackEntry.new.callback (http://localhost:53529/dart_sdk.js:37235:16)
at Object._microtaskLoop (http://localhost:53529/dart_sdk.js:40708:13)
at _startMicrotaskLoop (http://localhost:53529/dart_sdk.js:40714:13)
at http://localhost:53529/dart_sdk.js:36191:9

Fix more understandable Document

  await minio.putObject(
    'mybucket', 
    'myobject', 
    Stream<Uint8List>.value(Uint8List(1024)),
    onProgress: (bytes) => print('$bytes uploaded'),
  );
}

What is Stream<Uint8List>.value(Uint8List(1024)),??
dummy?

[Feature] Get upload url instead of etag?

Although I can construct the url myself given the bucket and file location, I think it'd be nice if minio.putObject/minio.fPutObject would return an object with the url of the upload location and the etag as fields instead of just the etag

Thanks for your work on the library. Let me know if it'd be an easy PR and I could do it myself

Upload speed is too slow

I set up a MiniO server locally and tested the upload of 16MB files by flutter web app.
It took 22 seconds. Since there is no network bottleneck to limit the speed,
such a slow speed is a problem.

Incompatibility with Flutter 2.0.0 SDK

Because every version of minio depends on intl ^0.16.1 and every version of flutter_localizations from sdk depends on intl 0.17.0, minio is incompatible with flutter_localizations from sdk.

listObjects(bucketName) returns 500 error (Possible AWS auth v4 issue)

Hi, first of all thank you for the package.
I'm currently trying to run a listObjects(myBucket), the issue is that I'm always getting an error back. I've tried it via aws cli, but there everything works without issue.
Maybe for debugging this could be helpfull:
S3 endpoint: s3.filebase.com

I've also looked at both requests and found one maybe two possible differences between the library headers and the aws cli headers.

Library Headers:

REQUEST: GET https://s3.filebase.com/gs9omvzyaeobdt9fxipudyo6dna2?&prefix=&delimiter=%2F&list-type=2&maxKeys=1000
I/flutter (26600): host: s3.filebase.com
I/flutter (26600): user-agent: MinIO (Unknown; Unknown) minio-dart/2.0.0
I/flutter (26600): x-amz-date: 20210824T223349Z
I/flutter (26600): x-amz-content-sha256: UNSIGNED-PAYLOAD
I/flutter (26600): authorization: AWS4-HMAC-SHA256 Credential=>>MYKEY<</20210824/us-east-1/s3/aws4_request, 
SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=>>A SIGNATURE<<

(the >>VARNAME<<, replaces the value, as I'm not sure if it's sensitive or not).

AWS cli headers:

REQUEST: GET https://s3.filebase.com/gs9omvzyaeobdt9fxipudyo6dna2?&prefix=&delimiter=%2F&list-type=2&maxKeys=1000
headers={'User-Agent': b'aws-cli/2.2.31 Python/3.8.8 Linux/5.4.0-81-generic exe/x86_64.ubuntu.20 prompt/off command/s3.ls', 
'X-Amz-Date': b'20210824T222928Z', 
'X-Amz-Content-SHA256': b'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', 
'Authorization': b'AWS4-HMAC-SHA256 Credential=>>MYKEY<</20210824/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date
, Signature=>>A DIFFERENT SIGNATURE<<
}

The first difference is the user agent, idk if that is important, some backends maybe have issues with that, but the second one is the x-amz-content-sha256: Which is UNSIGNED-PAYLOAD vs e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

Due to this stackoverflow posts answer (the last one with 0 upvotes), I have the feeling that one might need to add this empty string hash/signature with the request instead of UNSIGNED-PAYLOAD. The empty string hash/signature of the answer matches with the one the cli provided. So I'm currently assuming that is the source of the error, but idk for sure.

Here also the error response, if needed, but I guess it's not really informative.

RESPONSE: 500 Internal Server Error
I/flutter (26600): connection: keep-alive
I/flutter (26600): date: Tue, 24 Aug 2021 22:34:04 GMT
I/flutter (26600): transfer-encoding: chunked
I/flutter (26600): x-runtime: 0.010055
I/flutter (26600): content-type: application/xml
I/flutter (26600): x-amz-request-id: ebd52b58-e1e3-4d46-9c0e-3a5f0f014617
I/flutter (26600): x-amz-id-2: ZmlsZWJhc2UtNThjODY1NGM2OS1ubm0yOQ==
I/flutter (26600): server: Filebase
I/flutter (26600): <?xml version="1.0" encoding="UTF-8"?><Error><Code>InternalError</Code><Message>We encountered an internal error. Please try again.</Message><RequestId>ebd52b58-e1e3-4d46-9c0e-3a5f0f014617</RequestId><HostId>ZmlsZWJhc2UtNThjODY1NGM2OS1ubm0yOQ==</HostId></Error> 

The devide I'm currently using is an Galaxy A51 with Android 11

After reading around I realized it might be an issue with AWS signature version 4, due to the fact that the storage provider only support AWS v4 signature requests.

Region issue: not use the region specified.

minio = Minio(
      endPoint: 's3.amazonaws.com',
      accessKey: 'xxx',
      secretKey: 'xxx',
      region: 'ap-northeast-1'
    );

MinioError: The authorization header is malformed; the region is wrong; expecting 'us-east-1'.

The AWS Access Key Id you provided does not exist in our records.

final minio = Minio(
region: response.options.region,
endPoint: 's3.amazonaws.com',
accessKey: response.options.accessKeyId,
secretKey: response.options.secretAccessKey,
sessionToken: response.options.sessionToken);
try {
String result = await minio.fPutObject(
response.options.Bucket, response.options.Key, file.path);
print(result);
} catch (e) {
print(e);
}
Why it happen?

where is incorrect? I want to upload an image file to "amazonaws"

Future<String> minioUploadFile( String bucketName, String key, String endPoint, String accessKey, String secretKey, String sessionToken, { File file, String fileName, String port, String region, }) async { assert(file != null || (fileName != null && fileName.isNotEmpty)); final minio = Minio( endPoint: 's3-us-west-1.amazonaws.com', accessKey: accessKey, secretKey: secretKey, sessionToken: sessionToken, region: 'us-west-1', enableTrace: true, ); return await minio.fPutObject( bucketName, key, fileName ?? file.absolute.path); }

The debug is interrupted, when the web upload 2G file reaches 55%.

Tested 60MB file upload and it works fine.
Test 2G file upload, UI freezes, wait for a few minutes, Debug suddenly interrupts, see the screenshot.

image

<closure> (/Users/will/development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:56)
<asynchronous gap> (Unknown Source:0)
send (/Users/will/development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:54)
<asynchronous gap> (Unknown Source:0)
<closure> (/Users/will/development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:56)
<asynchronous gap> (Unknown Source:0)
send (/Users/will/development/flutter/.pub-cache/hosted/pub.dartlang.org/http-0.13.4/lib/src/browser_client.dart:54)
<asynchronous gap> (Unknown Source:0)
addPickedFile (/Users/will/Downloads/flutter_file_picker-master/lib/_internal/file_picker_web.dart:98)
<closure> (/Users/will/Downloads/flutter_file_picker-master/lib/_internal/file_picker_web.dart:119)
<asynchronous gap> (Unknown Source:0)
changeEventListener (/Users/will/Downloads/flutter_file_picker-master/lib/_internal/file_picker_web.dart:121)
  void _pickFiles() async {
    _resetState();
    try {
      _directoryPath = null;
      _paths = (await FilePicker.platform.pickFiles(
        type: _pickingType,
        allowMultiple: _multiPick,
        onFileLoading: (FilePickerStatus status) => print(status),
        allowedExtensions: (_extension?.isNotEmpty ?? false)
            ? _extension?.replaceAll(' ', '').split(',')
            : null,
      ))
          ?.files;
    } on PlatformException catch (e) {
      _logException('Unsupported operation' + e.toString());
    } catch (e) {
      _logException(e.toString());
    }

    // final file = _paths?.single;
    // print(file);
    final minio = Minio(
      endPoint: 'xxx',
      accessKey: 'xxx,
      secretKey: 'xxx',
      useSSL: true,
      // enableTrace: true,
    );

    for (var file in _paths!) {
      await minio.putObject("snowball", file.name, Stream.value(file.bytes!),
          onProgress: (bytes) {
        print('[${file.name}] ${(bytes / file.size) * 100}% uploaded');
        title = '${(bytes / file.size) * 100}%';
        setState(() {});
      });
    }

parse error when listening to notifications

This is what I call:

    final NotificationPoller bucketNotificationPoller = _otpMinio.listenBucketNotification(
      _userBucket,
      prefix: 'Dido_otp/',
      events: <String>['s3:ObjectCreated:*'],
    );

This is the error I get:

[ERROR:flutter/lib/ui/ui_dart_state.cc(171)] Unhandled Exception: FormatException: Unexpected character (at character 1)
<?xml version="1.0" encoding="UTF-8"?>
^

#0      _ChunkedJsonParser.fail (dart:convert-patch/convert_patch.dart:1404:5)
#1      _ChunkedJsonParser.parseNumber (dart:convert-patch/convert_patch.dart:1271:9)
#2      _ChunkedJsonParser.parse (dart:convert-patch/convert_patch.dart:936:22)
#3      _parseJson (dart:convert-patch/convert_patch.dart:40:10)
#4      JsonDecoder.convert (dart:convert/json.dart:505:36)
#5      JsonCodec.decode (dart:convert/json.dart:156:41)
#6      NotificationPoller._checkForChanges (package:minio/src/minio_poller.dart:61:25)
<asynchronous suspension>
#7      NotificationPoller.start (package:minio/src/minio_poller.dart:30:13)
#8      Minio.listenBucketNotification (package:minio/src/minio.dart:432:14)

Big file upload error

Change the custed.png to 140MB.
Then run the minio_example.dart , Show the error:

bucket 01test created
--- object region:
us-east-1
Unhandled exception:
MinioError: The request signature we calculated does not match the signature you provided. Check your key and signing method.
#0      validate 
package:minio/src/minio_helpers.dart:222
#1      Minio.listIncompleteUploadsQuery 
package:minio/src/minio.dart:412
<asynchronous suspension>
#2      Minio.findUploadId 
package:minio/src/minio.dart:195
#3      MinioUploader.initMultipartUpload 
package:minio/src/minio_uploader.dart:123
#4      MinioUploader.addStream 
package:minio/src/minio_uploader.dart:53
<asynchronous suspension>
#5      Stream.pipe  (dart:async/stream.dart:740:27)
#6      Minio.putObject 
package:minio/src/minio.dart:832
#7      MinioX.fPutObject 
package:minio/io.dart:31
<asynchronous suspension>
#8      main 
example/minio_example.dart:36
<asynchronous suspension>
#9      _startIsolate.<anonymous closure>  (dart:isolate-patch/isolate_patch.dart:301:19)
#10     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:168:12)

Exited (255)

listBuckets assumes XML type but type is not guaranteed

When parsing the XML results for providers like Backblaze it is not guaranteed that XML is going to be of type XmlElement. In my case there were XmlText objects. Because of this, it would throw a parsing error.

3.5.5 code in the listBuckets() function in minio.dart line 486.
return bucketsNode.children
.map((n) => Bucket.fromXml(n as XmlElement))
.toList();

Notice it assumes the type to be XmlElement as parses it as such but that is not guaranteed. Below is a change I suggest which avoids throwing errors by checking the type and not relying on type assumption:

List results = [];
for (xml.XmlNode node in bucketsNode.children) {
if (node is xml.XmlElement) {
results.add(Bucket.fromXml(node as XmlElement));
}
}

Im sure there is a more professional and elegant way to write the code than what I've written, but without type safety I need to fork your code with this change or things break with BackBlaze. Thanks!

How can i create File from stream on web?

When getting files from Bucket with this code
File file = await stream.pipe(File(filePath).openWrite());
it works on iOS and Android perfectly.

But on the web release there is no path for creating File. How can i create File from stream on web?

Thanks.

Feature Request: Use Cognito Federated Pool IDs

Some of the other packages use Cognito Federated Pool IDs. I find these easier to manage than passing through access keys and secret keys. Could you add the option to use a cognito pool id instead of the access and secret keys?

Upload with Public Read Permissions?

Currently, this plugin uploads an image to my public S3 bucket with permission to read - only by the object owner.

How can I upload an image so that it can be read publicly by everyone?

There doesn't seem to be a parameter in this function.

await minio.fPutObject('mybucket', objectpath, croppedFile.path);

Is there another way?

presignedPostPolicy error

NoSuchMethodError: Class 'List<dynamic>' has no instance method 'push'.
Receiver: Instance(length:3) of '_GrowableList'

Feature Request Enable s3 accelerated transfers

I'd like to use transfer acceleration with Minio and S3.

It should be as easy as a boolean in the putObject function call and then on the backend changing the endpoint to be ".s3-accelerate.amazonaws.com" instead of ".s3.amazonaws.com".

This would greatly improve the usage of this package for me.

AccessKey error

We tested minio with temporary credentials and we are getting the following errors

Reloaded 2 of 1005 libraries in 1,117ms.
I/flutter (25842): REQUEST: GET https://s3.amazonaws.com/
I/flutter (25842): host: s3.amazonaws.com
I/flutter (25842): user-agent: MinIO (Unknown; Unknown) minio-dart/0.1.5
I/flutter (25842): x-amz-date: 20200612T010115Z
I/flutter (25842): x-amz-content-sha256: UNSIGNED-PAYLOAD
I/flutter (25842): authorization: AWS4-HMAC-SHA256 Credential=ASIASVFFWV5MSGEXH4JG/20200612/us-east-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=329c067014099da6a7dcb51b23480cdca49d18b4733137e78df55a3ebada33dd
I/flutter (25842):
I/flutter (25842): file path:File: '/storage/emulated/0/DCIM/Camera/VID_20200611_172040.mp4'
I/flutter (25842): RESPONSE: 403 Forbidden
I/flutter (25842): content-type: application/xml
I/flutter (25842): x-amz-request-id: DD0CE16CD6BF51B9
I/flutter (25842): date: Fri, 12 Jun 2020 01:01:13 GMT
I/flutter (25842): transfer-encoding: chunked
I/flutter (25842): x-amz-id-2: 98BL1oHAXwPJVI1vVSRsXCBJ/Lqru7BaaPk2tlvRn0g/NglEvhGhUwldhEjMmKoRLdDQlB85BFw=
I/flutter (25842): server: AmazonS3
I/flutter (25842):
I/flutter (25842): InvalidAccessKeyIdThe AWS Access Key Id you provided does not exist in our records.ASIASVFFWV5MSGEXH4JGDD0CE16CD6BF51B998BL1oHAXwPJVI1vVSRsXCBJ/Lqru7BaaPk2tlvRn0g/NglEvhGhUwldhEjMmKoRLdDQlB85BFw=

now if I use the same key on the cli it works with the following credentials profile (do not worry they are temporary and have already expired)

[fiteo-upload]
aws_access_key_id = ASIASVFFWV5MSGEXH4JG
aws_secret_access_key = qAT5hn4vbypoROhTG31bRKn9+9SiaNYaaEUXfOr/
aws_session_token = FwoGZXIvYXdzEOr//////////wEaDEvL5iTJOrRKjkoO5iKeAlvBDm1P+jbKv//FXBE0nNQhqAeVZO1TjvkBGcYrhpXzw4KR1mKfJgFqlgR0BdbOgH832s/sAaG5pmhW889DrujWFWZL6KRWb3oUsOldbqpstT1HNjy0pBS2RFGaquXcR9JdeSUa8HFPJ4Cfsu9oM7RYFriGv18cg/Bbvacq9p7lAmGCTCBX66/osecQxuK8SmPbtObRw5df55HvyLvoKM+G2OYTXB1o1w2QxzoD/nxRrRExJmKFQRWnX2BNugnWl2zzUlJxAMELl0PFJzTxlE7Wgl0lwKCXFEnb795Rp+IatSWkxnBgtKmwEj3Bp8dh824CD1MT5RWu4byzIUUbgopLkZujoWcbucjJSK2HH3j2JHCghb4JyJLIHfqBXVUoiZ2L9wUyLfzzRL0fmY5v0C95MbLgOFgnMdE9CcOmzqwTtAzKRoA6jWwaDonXljIKWtT45w==
region = us-east-1


admins-mbp:.aws pdavidoff$ aws s3 ls s3://coacheo-test --profile fiteo-upload
PRE 12345/

fPutObject content-type: 'image/jpeg' is ignored

Hello,
when uploading image via fPutObject metadata are ignored

implementation of fPutObject does

metaData = insertContentType(metaData, filePath);

which correctly returns 'image/jpeg' ,

by using lookupMimeType(path)

however this map is not provided to putObject which is called at the end as a part of return
So at the end minio think of file as application/octet-stream

david@jtsnc:~$ mc stat minio/input/test.jpg
Name      : test.jpg
Date      : 2020-12-11 11:39:10 UTC 
Size      : 3.2 MiB 
ETag      : 55e92ea2232c5354993c4e50473351f8 
Type      : file 
Metadata  :
  Content-Type: application/octet-stream 

fPutObject is not defined?

The below gives me a The method 'fPutObject' isn't defined for the type 'Minio'. error - any idea where I am going wrong? minio: ^1.3.0

import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:injectable/injectable.dart';
import 'package:minio/minio.dart';

@lazySingleton
class MinioService {
  final minio = Minio(
    endPoint: DotEnv().env['MINIO_ENDPOINT_DEV'],
    accessKey: DotEnv().env['MINIO_ACCESS_KEY_DEV'],
    secretKey: DotEnv().env['MINIO_SECRET_KEY_DEV'],
    useSSL: true,
  );

  final bucket = '00test';
  final object = 'custed.png';
  final copy1 = 'custed.copy1.png';
  final copy2 = 'custed.copy2.png';

  Future<String> uploadProductPhoto(photo) async {
    final String etag = await minio.fPutObject(bucket, object, 'photos_product_upload/$object');
    print('--- etag:');
    print(etag);
    return etag;
  }
}

Files with symbols in name cause an AWS signature error

Issue
Filenames containing any of these symbols !@$&()=+; cause AWS to return an error:
SignatureDoesNotMatch "The request signature we calculated does not match the signature you provided. Check your key and signing method."

This is problematic because filenames such as "Image (Copy).png" are quite common on desktop OS's.

Files containing ~`[]{}#%^-_ in the name don't seem to affect the signature.

To Reproduce:
Specify an AWS S3 endpoint and bucket. Initiate an fPutObject request to upload a file containing one of the problematic symbols in the name. The response from Amazon will be "SignatureDoesNotMatch". Using minio: ^2.0.0-pre for testing.

listObjects is returning error

listObjects is returning 403 error when folder name includes space.
If folder name is not including space "NewFolder" then it is working correctly but if it is "New Folder" then it is returning error.
Hope you to let me know the reason or solution.
Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.