Skip to content
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

BaseClient::GetPresignedPostFormData always returns unable to get presigned post form data; valid policy must be provided #136

Closed
ijoseph opened this issue Apr 15, 2024 · 2 comments

Comments

@ijoseph
Copy link
Contributor

ijoseph commented Apr 15, 2024

Because !policy is always true here:

if (!policy) {

because the policy should be valid if it has an expiration, not if it lacks one -- this change is needed:

diff --git a/include/miniocpp/args.h b/include/miniocpp/args.h
index 2010b56..8132771 100644
--- a/include/miniocpp/args.h
+++ b/include/miniocpp/args.h
@@ -570,7 +570,7 @@ struct PostPolicy {
 
   ~PostPolicy() = default;
 
-  explicit operator bool() const { return !bucket.empty() && !expiration_; }
+  explicit operator bool() const { return !bucket.empty() && (bool) expiration_; }
 
   error::Error AddEqualsCondition(std::string element, std::string value);
   error::Error RemoveEqualsCondition(std::string element);
@balamurugana
Copy link
Member

@ijoseph feel free to send a PR

@balamurugana
Copy link
Member

fixed by #137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants