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

Sign URL uploads if configured #139

Merged
merged 1 commit into from
Dec 11, 2023

Conversation

geeosh
Copy link
Contributor

@geeosh geeosh commented Nov 27, 2023

When having Signed Uploads enabled, and using Uploadcare::Uploader.upload, it doesn't send the signature and expire parameters if using a URL (whereas it does if you use a file).

This PR introduces a few changes to use (Param::Upload::SignatureGenerator to add the signature and expire to the upload_from_url_body method.

Ideally both the upload_from_url_body method and the upload_many_body method would use the Param::Upload::UploadParamsGenerator service to generate params. Since the param keys are different, I didn't take the time to refactor that service, but it wouldn't be too hard. There is already code repetition for the store_value in both places.

Fix namespace for service

Add spec for upload_from_url

Fix requiring of SignatureGenerator and location of tests
@kraft001
Copy link
Collaborator

@geeosh The PR looks good to me!
Just need to fix (or at least mute) Rubocop issues before merging it

@kraft001 kraft001 changed the base branch from main to 4.4.0 December 11, 2023 06:23
@kraft001 kraft001 merged commit 2c6a314 into uploadcare:4.4.0 Dec 11, 2023
4 of 6 checks passed
@geeosh
Copy link
Contributor Author

geeosh commented Dec 11, 2023

@kraft001 sure thing, I can submit an update for this later this week.

vipulnsward added a commit that referenced this pull request Mar 9, 2024
* When polling, raise if an error is returned (#142)

Previously, if an error from the API was returned while polling for updates on a file, it would continue polling. I updated it so that it raises a RequestError if the API returns an error status. If not, it raises a RetryError, which is swallowed by the retry gem's `with_retries` block.

Example of an error that led to continued polling:

```
{"status":"error","error":"File validation error: Uploading of these file types is not allowed.","error_code":"DownloadFileValidationFailedError"}
```

* Sign URL uploads if configured (#139)

Fix namespace for service

Add spec for upload_from_url

Fix requiring of SignatureGenerator and location of tests

* Merge with main and add changelog

* Bump version to 4.4.0

* Apply suggestions from code review

Co-authored-by: Roman Sedykh <[email protected]>

---------

Co-authored-by: Josh Schwartzman <[email protected]>
Co-authored-by: Roman Sedykh <[email protected]>
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

Successfully merging this pull request may close these issues.

2 participants