-
-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(storage_client): upload signed URL #495
Conversation
…o be used in web environment
dart_edge for example runs on the server, but compiles Dart to js, so |
@Vinzent03 |
retryController: retryController, | ||
); | ||
|
||
return cleanPath; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So far we are using (response as Map)['Key'] as String
to return the path in upload()
, but I see that storage-js uses cleanPath
everywhere. I guess they are always the same, so it doesn't matter.
assert(retryAttempts == null || retryAttempts >= 0, | ||
'retryAttempts has to be greater or equal to 0'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't it possible to make retryAttempts
non nullable?
int retryAttempts = 0,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, giving it a default value would be so much better!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I just remembered. There is a global settings for retryAttempt
, and if the retryAttempt
value passed to the individual methods are null
, it will fall back to the global default, so we might need to keep it nullable here.
const SignedUploadURLResponse({ | ||
required String signedUrl, | ||
required String path, | ||
required this.token, | ||
}) : super( | ||
signedUrl: signedUrl, | ||
path: path, | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we use the new super constructors?
const SignedUploadURLResponse({ | |
required String signedUrl, | |
required String path, | |
required this.token, | |
}) : super( | |
signedUrl: signedUrl, | |
path: path, | |
); | |
const SignedUploadURLResponse({ | |
required super.signedUrl, | |
required super.path, | |
required this.token, | |
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a great point. Currently, the minimum Dart SDK version is 2.15.0, and I believe the new super constructor was introduced on v2.17.0, so let's actually do that in another PR. I think we can bump the minimum SDK version to 2.17.0 and minimum Flutter version to 3.0.0 soon, since it's been a while for those to be around.
Isn't it better to add the documentation to the field itself and not just to the class? So that for example vscode can show the doc on |
@Vinzent03 |
What kind of change does this PR introduce?
Implements signed upload URL by adding Expose the
createUploadSignedUrl
,uploadToSignedUrl
, anduploadToSignedUrl
methods. This allows developers to first upload the file to their own server while attaching the token fromcreateSignedUploadUrl()
method, and then complete the upload process from their server to Supabase.I didn't add the binary version of
uploadToSignedUrl
method, as it is intended to be used in a server environment.Related supabase/storage-js#158, supabase/storage#282 (comment)