Skip to content

chore: modify range to allow queries specifying only the start index#184

Merged
kessplas merged 2 commits into
mainfrom
imabhichow/adjust-range-regex
Mar 1, 2024
Merged

chore: modify range to allow queries specifying only the start index#184
kessplas merged 2 commits into
mainfrom
imabhichow/adjust-range-regex

Conversation

@imabhichow

Copy link
Copy Markdown
Contributor

Issue #, if available:

Description of changes:

  • Adjust range regex to allow queries specifying only start index without specifying the end index, returns object from start index to end of stream.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Check any applicable:

  • Were any files moved? Moving files changes their URL, which breaks all hyperlinks to the files.

@imabhichow imabhichow requested a review from a team as a code owner February 6, 2024 23:26
adjustedRange[0] = Integer.parseInt(rangeSplit[1]);
adjustedRange[1] = Integer.parseInt(rangeSplit[2]);
adjustedRange[0] = Integer.parseInt(rangeSplit[0]);
adjustedRange[1] = (rangeSplit.length < 2 || rangeSplit[1].isEmpty()) ? Integer.MAX_VALUE : Integer.parseInt(rangeSplit[1]);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using Integer.MAX_VALUE is not correct, the type signature is long so we should use longs here and elsewhere.

return null;
}
if (!range.matches("bytes=[0-9]+-[0-9]+")) {
if (!range.matches("^bytes=(\\d+-\\d+|\\d+-)$")) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since this is a public method, we should add some unit tests around the range input and how it is handled

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agreed, will add some unit test cases around desired range and crypto range

@kessplas kessplas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kessplas kessplas merged commit 765b9c6 into main Mar 1, 2024
@kessplas kessplas deleted the imabhichow/adjust-range-regex branch March 1, 2024 23:45
josecorella pushed a commit that referenced this pull request Mar 21, 2024
## [3.1.2](v3.1.1...v3.1.2) (2024-03-21)

### Fixes

* create clients only if necessary ([#187](#187)) ([ea0c0c7](ea0c0c7))
* do not signal onComplete when the incoming buffer length is less than the cipher block ([#209](#209)) ([8b1a686](8b1a686))

### Maintenance

* fix dependabot.yml ([#190](#190)) ([5ee8b08](5ee8b08))
* modify range to allow queries specifying only the start index ([#184](#184)) ([765b9c6](765b9c6))
* **README:** detail no unencrypted pass through ([#189](#189)) ([576ea66](576ea66)), closes [#186](#186) [/github.com//issues/186#issuecomment-1973016669](https://github.com/aws//github.com/aws/amazon-s3-encryption-client-java/issues/186/issues/issuecomment-1973016669)
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