-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix Uploadcare::File.remote_copy raising response errors #171
Conversation
WalkthroughThe recent updates focus on improving the Changes
Poem
TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (6)
- CHANGELOG.md (1 hunks)
- api_examples/rest_api/post_files_remote_copy.rb (1 hunks)
- lib/uploadcare/entity/file.rb (1 hunks)
- spec/fixtures/vcr_cassettes/rest_file_remote_copy.yml (1 hunks)
- spec/support/vcr.rb (1 hunks)
- spec/uploadcare/entity/file_spec.rb (1 hunks)
Files skipped from review due to trivial changes (3)
- api_examples/rest_api/post_files_remote_copy.rb
- lib/uploadcare/entity/file.rb
- spec/fixtures/vcr_cassettes/rest_file_remote_copy.yml
Additional Context Used
LanguageTool (7)
CHANGELOG.md (7)
Near line 5: Possible typo: you repeated a word
Context: # Changelog ## Unreleased ### Fixed * Fixed thatUploadcare::File.remote_copy
met...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Near line 12: Possible typo: you repeated a word
Context: ...tConverter. ## 4.4.1 — 2024-04-27 ### Added * Added
AWS Rekognition Moderation` Add-On. * ...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Near line 123: In American English, abbreviations like “etc.” require a period.
Context: ...s mime-type, image (dimensions, format, etc), video information (duration, format, ...
Rule ID: ETC_PERIOD
Near line 123: In American English, abbreviations like “etc.” require a period.
Context: ...information (duration, format, bitrate, etc), audio information, etc - Field `met...
Rule ID: ETC_PERIOD
Near line 123: In American English, abbreviations like “etc.” require a period.
Context: ...rmat, bitrate, etc), audio information, etc - Fieldmetadata
that includes arbi...
Rule ID: ETC_PERIOD
Near line 129: This phrase is redundant (‘I’ stands for ‘interface’). Use simply “API”.
Context: ...plications ### Added - Add Uploadcare API interface: -Uploadcare::FileMetadata
-...
Rule ID: ACRONYM_TAUTOLOGY
Near line 155: Possible typo: you repeated a word
Context: ...tureVerifier## 3.1.1 — 2021-10-13 - Fixed
Uploadcare::File#store- Fixed
Uploadcare::File#delete` ## 3.1.0 — 2...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Markdownlint (73)
CHANGELOG.md (73)
82: Expected: asterisk; Actual: dash
Unordered list style
83: Expected: asterisk; Actual: dash
Unordered list style
91: Expected: asterisk; Actual: dash
Unordered list style
92: Expected: asterisk; Actual: dash
Unordered list style
96: Expected: asterisk; Actual: dash
Unordered list style
109: Expected: asterisk; Actual: dash
Unordered list style
110: Expected: asterisk; Actual: dash
Unordered list style
111: Expected: asterisk; Actual: dash
Unordered list style
112: Expected: asterisk; Actual: dash
Unordered list style
113: Expected: asterisk; Actual: dash
Unordered list style
114: Expected: asterisk; Actual: dash
Unordered list style
115: Expected: asterisk; Actual: dash
Unordered list style
116: Expected: asterisk; Actual: dash
Unordered list style
117: Expected: asterisk; Actual: dash
Unordered list style
118: Expected: asterisk; Actual: dash
Unordered list style
122: Expected: asterisk; Actual: dash
Unordered list style
123: Expected: asterisk; Actual: dash
Unordered list style
124: Expected: asterisk; Actual: dash
Unordered list style
125: Expected: asterisk; Actual: dash
Unordered list style
129: Expected: asterisk; Actual: dash
Unordered list style
130: Expected: asterisk; Actual: dash
Unordered list style
131: Expected: asterisk; Actual: dash
Unordered list style
132: Expected: asterisk; Actual: dash
Unordered list style
133: Expected: asterisk; Actual: dash
Unordered list style
137: Expected: asterisk; Actual: dash
Unordered list style
141: Expected: asterisk; Actual: dash
Unordered list style
142: Expected: asterisk; Actual: dash
Unordered list style
146: Expected: asterisk; Actual: dash
Unordered list style
150: Expected: asterisk; Actual: dash
Unordered list style
151: Expected: asterisk; Actual: dash
Unordered list style
155: Expected: asterisk; Actual: dash
Unordered list style
156: Expected: asterisk; Actual: dash
Unordered list style
160: Expected: asterisk; Actual: dash
Unordered list style
161: Expected: asterisk; Actual: dash
Unordered list style
162: Expected: asterisk; Actual: dash
Unordered list style
166: Expected: asterisk; Actual: dash
Unordered list style
167: Expected: asterisk; Actual: dash
Unordered list style
171: Expected: asterisk; Actual: dash
Unordered list style
172: Expected: asterisk; Actual: dash
Unordered list style
173: Expected: asterisk; Actual: dash
Unordered list style
177: Expected: asterisk; Actual: dash
Unordered list style
181: Expected: asterisk; Actual: dash
Unordered list style
182: Expected: asterisk; Actual: dash
Unordered list style
186: Expected: asterisk; Actual: dash
Unordered list style
187: Expected: asterisk; Actual: dash
Unordered list style
188: Expected: asterisk; Actual: dash
Unordered list style
189: Expected: asterisk; Actual: dash
Unordered list style
190: Expected: asterisk; Actual: dash
Unordered list style
196: Expected: asterisk; Actual: dash
Unordered list style
200: Expected: asterisk; Actual: dash
Unordered list style
201: Expected: asterisk; Actual: dash
Unordered list style
202: Expected: asterisk; Actual: dash
Unordered list style
203: Expected: asterisk; Actual: dash
Unordered list style
204: Expected: asterisk; Actual: dash
Unordered list style
130: Expected: 2; Actual: 4
Unordered list indentation
131: Expected: 2; Actual: 4
Unordered list indentation
7: Expected: 0 or 2; Actual: 1
Trailing spaces
41: Expected: 1; Actual: 2
Multiple consecutive blank lines
54: Expected: 1; Actual: 2
Multiple consecutive blank lines
61: Expected: 1; Actual: 2
Multiple consecutive blank lines
5: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
8: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
10: Expected: 1; Actual: 0; Above
Headings should be surrounded by blank lines
12: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
16: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
38: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
6: null
Lists should be surrounded by blank lines
9: null
Lists should be surrounded by blank lines
9: null
Lists should be surrounded by blank lines
13: null
Lists should be surrounded by blank lines
17: null
Lists should be surrounded by blank lines
39: null
Lists should be surrounded by blank lines
101: null
Lists should be surrounded by blank lines
Additional comments not posted (4)
spec/support/vcr.rb (1)
9-10
: Sensitive data filtering added for security enhancement.This is a crucial update for maintaining security by ensuring that sensitive keys are not exposed in VCR cassettes. Good job on implementing dynamic key retrieval.
spec/uploadcare/entity/file_spec.rb (2)
47-55
: Updated tests reflect new behavior ofremote_copy
.The tests are well-updated to check the new behavior of the
remote_copy
method returning a URL string. It's good to see thorough testing, including error handling when the specified storage is unavailable.
56-56
: Error handling test for unavailable storage.This test ensures robust error handling by checking for a specific error message when the storage is unavailable. It's crucial for maintaining reliability in production environments.
CHANGELOG.md (1)
5-7
: Changelog updated to reflect recent fixes.The changelog entry correctly documents the fix made to the
remote_copy
method. It's important to keep this document up-to-date for users and developers.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
lib/uploadcare/client/multipart_upload_client.rb (1)
[!TIP]
Codebase VerificationThe
form_data_for
method inlib/uploadcare/client/upload_client.rb
expects afile
parameter, which conflicts with the refactored method inlib/uploadcare/client/multipart_upload_client.rb
that no longer provides this parameter. This discrepancy needs to be addressed to ensure compatibility.
lib/uploadcare/client/upload_client.rb: form_data_for(file)
Analysis chain
Line range hint
50-56
: The refactoring ofform_data_for
simplifies parameter handling and enhances clarity by utilizing inheritance.Scripts Executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that the superclass method `form_data_for` is compatible with the changes. # Test: Search for the superclass method implementation. Expect: It should handle the absence of the `file` parameter gracefully. ast-grep --lang ruby --pattern $'def form_data_for($_) { $$$ }' lib/uploadcare/client/upload_client.rbLength of output: 448
Script:
#!/bin/bash # Description: Search for the superclass method `form_data_for` in the entire codebase to verify its implementation. # Test: Search for the method definition in the entire codebase. ast-grep --lang ruby --pattern 'def form_data_for($_) { $$$ }'Length of output: 409
Script:
#!/bin/bash # Description: Search for the superclass method `form_data_for` in the entire codebase to verify its implementation. # Test: Search for the method definition in the entire codebase. rg 'def form_data_for'Length of output: 172
Script:
#!/bin/bash # Description: Extract and review the `form_data_for` method in `lib/uploadcare/client/upload_client.rb` to verify its implementation. # Test: Extract the method definition and its body. rg -A 10 'def form_data_for' lib/uploadcare/client/upload_client.rbLength of output: 502
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- lib/uploadcare/client/multipart_upload_client.rb (1 hunks)
Additional Context Used
LanguageTool (10)
CHANGELOG.md (10)
Near line 5: Possible typo: you repeated a word
Context: # Changelog ## Unreleased ### Fixed * Fixed theUploadcare::File.remote_copy
meth...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Near line 6: Possible missing comma found.
Context: ...ixed theUploadcare::File.remote_copy
method which raised an `ApiStruct::EntityError...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA
Near line 6: Possible missing comma found.
Context: ...ruct::EntityError: {url} must be Hash. Now returns a string instead of a
File` en...
Rule ID: AI_HYDRA_LEO_MISSING_COMMA
Near line 11: Possible typo: you repeated a word
Context: ...tConverter. ## 4.4.1 — 2024-04-27 ### Added * Added
AWS Rekognition Moderation` Add-On. * ...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Near line 82: Possible missing preposition found.
Context: ...Changed - Update the gem description - Allow ENV keys to be configured after the gem...
Rule ID: AI_HYDRA_LEO_MISSING_TO
Near line 122: In American English, abbreviations like “etc.” require a period.
Context: ...s mime-type, image (dimensions, format, etc), video information (duration, format, ...
Rule ID: ETC_PERIOD
Near line 122: In American English, abbreviations like “etc.” require a period.
Context: ...information (duration, format, bitrate, etc), audio information, etc - Field `met...
Rule ID: ETC_PERIOD
Near line 122: In American English, abbreviations like “etc.” require a period.
Context: ...rmat, bitrate, etc), audio information, etc - Fieldmetadata
that includes arbi...
Rule ID: ETC_PERIOD
Near line 128: This phrase is redundant (‘I’ stands for ‘interface’). Use simply “API”.
Context: ...plications ### Added - Add Uploadcare API interface: -Uploadcare::FileMetadata
-...
Rule ID: ACRONYM_TAUTOLOGY
Near line 154: Possible typo: you repeated a word
Context: ...tureVerifier## 3.1.1 — 2021-10-13 - Fixed
Uploadcare::File#store- Fixed
Uploadcare::File#delete` ## 3.1.0 — 2...
Rule ID: ENGLISH_WORD_REPEAT_RULE
Markdownlint (74)
CHANGELOG.md (74)
81: Expected: asterisk; Actual: dash
Unordered list style
82: Expected: asterisk; Actual: dash
Unordered list style
90: Expected: asterisk; Actual: dash
Unordered list style
91: Expected: asterisk; Actual: dash
Unordered list style
95: Expected: asterisk; Actual: dash
Unordered list style
108: Expected: asterisk; Actual: dash
Unordered list style
109: Expected: asterisk; Actual: dash
Unordered list style
110: Expected: asterisk; Actual: dash
Unordered list style
111: Expected: asterisk; Actual: dash
Unordered list style
112: Expected: asterisk; Actual: dash
Unordered list style
113: Expected: asterisk; Actual: dash
Unordered list style
114: Expected: asterisk; Actual: dash
Unordered list style
115: Expected: asterisk; Actual: dash
Unordered list style
116: Expected: asterisk; Actual: dash
Unordered list style
117: Expected: asterisk; Actual: dash
Unordered list style
121: Expected: asterisk; Actual: dash
Unordered list style
122: Expected: asterisk; Actual: dash
Unordered list style
123: Expected: asterisk; Actual: dash
Unordered list style
124: Expected: asterisk; Actual: dash
Unordered list style
128: Expected: asterisk; Actual: dash
Unordered list style
129: Expected: asterisk; Actual: dash
Unordered list style
130: Expected: asterisk; Actual: dash
Unordered list style
131: Expected: asterisk; Actual: dash
Unordered list style
132: Expected: asterisk; Actual: dash
Unordered list style
136: Expected: asterisk; Actual: dash
Unordered list style
140: Expected: asterisk; Actual: dash
Unordered list style
141: Expected: asterisk; Actual: dash
Unordered list style
145: Expected: asterisk; Actual: dash
Unordered list style
149: Expected: asterisk; Actual: dash
Unordered list style
150: Expected: asterisk; Actual: dash
Unordered list style
154: Expected: asterisk; Actual: dash
Unordered list style
155: Expected: asterisk; Actual: dash
Unordered list style
159: Expected: asterisk; Actual: dash
Unordered list style
160: Expected: asterisk; Actual: dash
Unordered list style
161: Expected: asterisk; Actual: dash
Unordered list style
165: Expected: asterisk; Actual: dash
Unordered list style
166: Expected: asterisk; Actual: dash
Unordered list style
170: Expected: asterisk; Actual: dash
Unordered list style
171: Expected: asterisk; Actual: dash
Unordered list style
172: Expected: asterisk; Actual: dash
Unordered list style
176: Expected: asterisk; Actual: dash
Unordered list style
180: Expected: asterisk; Actual: dash
Unordered list style
181: Expected: asterisk; Actual: dash
Unordered list style
185: Expected: asterisk; Actual: dash
Unordered list style
186: Expected: asterisk; Actual: dash
Unordered list style
187: Expected: asterisk; Actual: dash
Unordered list style
188: Expected: asterisk; Actual: dash
Unordered list style
189: Expected: asterisk; Actual: dash
Unordered list style
195: Expected: asterisk; Actual: dash
Unordered list style
199: Expected: asterisk; Actual: dash
Unordered list style
200: Expected: asterisk; Actual: dash
Unordered list style
201: Expected: asterisk; Actual: dash
Unordered list style
202: Expected: asterisk; Actual: dash
Unordered list style
203: Expected: asterisk; Actual: dash
Unordered list style
129: Expected: 2; Actual: 4
Unordered list indentation
130: Expected: 2; Actual: 4
Unordered list indentation
40: Expected: 1; Actual: 2
Multiple consecutive blank lines
53: Expected: 1; Actual: 2
Multiple consecutive blank lines
60: Expected: 1; Actual: 2
Multiple consecutive blank lines
5: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
7: Expected: 1; Actual: 0; Above
Headings should be surrounded by blank lines
7: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
9: Expected: 1; Actual: 0; Above
Headings should be surrounded by blank lines
11: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
15: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
37: Expected: 1; Actual: 0; Below
Headings should be surrounded by blank lines
6: null
Lists should be surrounded by blank lines
6: null
Lists should be surrounded by blank lines
8: null
Lists should be surrounded by blank lines
8: null
Lists should be surrounded by blank lines
12: null
Lists should be surrounded by blank lines
16: null
Lists should be surrounded by blank lines
38: null
Lists should be surrounded by blank lines
100: null
Lists should be surrounded by blank lines
Additional comments not posted (5)
lib/uploadcare/client/multipart_upload_client.rb (4)
Line range hint
12-18
: Theupload
method implementation looks solid and well-structured.
Line range hint
24-32
: Theupload_start
method is correctly implemented to initiate multipart uploads.
Line range hint
34-42
: Theupload_complete
method effectively finalizes the multipart upload process.
Line range hint
58-62
: Thepost
method correctly handles API requests with throttling, ensuring robustness in network interactions.CHANGELOG.md (1)
6-6
: The changelog entry clearly documents the fix toUploadcare::File.remote_copy
. Consider incorporating the previous review's suggestion for enhanced clarity.- * Fixed the `Uploadcare::File.remote_copy` method which raised an `ApiStruct::EntityError: {url} must be Hash`. Now returns a string instead of a `File` entity instance. + * Fixed the `Uploadcare::File.remote_copy` method which raised an `ApiStruct::EntityError: {url} must be Hash`. Now returns a string instead of a `File` entity instance.
Description
Checklist
Summary by CodeRabbit
Bug Fixes
Uploadcare::File.remote_copy
method to prevent errors related to input parameter type.Enhancements
remote_copy
method to return a string instead of aFile
entity instance.Security
<uploadcare_public_key>
and<uploadcare_secret_key>
) in test configurations.Testing