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

Fix that Signed urls did not work with nth notation for groups as well as when using ~ in URLs #174

Merged
merged 2 commits into from
Jul 6, 2024

Conversation

vipulnsward
Copy link
Collaborator

@vipulnsward vipulnsward commented Jul 6, 2024

Description

Fix that Signed urls did not work with nth notation for groups as well as when using ~ in URLs
Closes #167 #138

Checklist

Summary by CodeRabbit

  • Bug Fixes

    • Improved signed URLs to handle paths containing ~ correctly.
  • New Features

    • Enhanced URL generation to support groups and nth file type notation within groups.

…l as when using ~ in urls. Add proper escaping for the same
Copy link
Contributor

coderabbitai bot commented Jul 6, 2024

Walkthrough

This update enhances the URL sanitization mechanism in the akamai_generator by introducing a method to escape delimiters, and expands testing for URL generation involving file groups. Additionally, a change is documented in the CHANGELOG.md addressing an issue with ~ in URL paths.

Changes

Files/Paths Change Summary
lib/uploadcare/signed_url_generators/akamai_generator.rb Added sanitized_delimiter_path method to sanitize delimiter paths by replacing tildes with hexadecimal representation.
spec/uploadcare/signed_url_generators/akamai_generator_spec.rb Added new contexts to test URL generation for groups and nth file type notation within groups.
CHANGELOG.md Documented the functionality change addressing an issue with signed URLs containing ~ and improved handling of grouped file URLs.

Poem

In code we trust, beneath the sky so bright,
URLs signed anew, with paths set right.
No tilde shall obscure our way,
As hexadecimal paves paths clear as day.
🐇✨ Logic refined, let the tests take flight!


Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e0db13d and cb175c4.

Files selected for processing (2)
  • lib/uploadcare/signed_url_generators/akamai_generator.rb (1 hunks)
  • spec/uploadcare/signed_url_generators/akamai_generator_spec.rb (1 hunks)
Additional comments not posted (4)
lib/uploadcare/signed_url_generators/akamai_generator.rb (2)

38-40: LGTM! Path sanitization added.

The build_acl method now correctly sanitizes paths using the sanitized_delimiter_path method.


44-47: LGTM! Path sanitization implemented.

The sanitized_delimiter_path method correctly replaces the ~ character with its hexadecimal representation.

spec/uploadcare/signed_url_generators/akamai_generator_spec.rb (2)

58-65: LGTM! Group URL generation tests added.

The tests correctly validate URL generation for groups.


67-74: LGTM! Nth file type notation tests added.

The tests correctly validate URL generation for nth file type notation within a group.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cb175c4 and 673185d.

Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
Additional context used
LanguageTool
CHANGELOG.md

[duplication] ~8-~8: Possible typo: you repeated a word
Context: ...ocumentConverter#convert` options. ### Fixed * Fixed that signed URLs now work with ~ in the...

(ENGLISH_WORD_REPEAT_RULE)


[duplication] ~13-~13: Possible typo: you repeated a word
Context: ...file URLs. ## 4.4.2 — 2024-05-29 ### Fixed * Fixed the Uploadcare::File.remote_copy meth...

(ENGLISH_WORD_REPEAT_RULE)

Additional comments not posted (3)
CHANGELOG.md (3)

9-9: LGTM!

The changelog entry is clear and concise.


10-10: Fix possible repeated word.

There is a potential typo: the word "that" is repeated. Consider revising the sentence for 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 `Uploadcare::File.remote_copy` method which raised an `ApiStruct::EntityError: {url} must be Hash`. Now returns a string instead of a `File` entity instance.

Likely invalid or redundant comment.


8-8: Fix possible repeated word.

There is a potential typo: the word "that" is repeated. Consider revising the sentence for clarity.

- * Fixed that signed URLs now work with ~ in the path. This also fixes signed URLs with grouped file URLs.
+ * Fixed signed URLs to work with ~ in the path. This also fixes signed URLs with grouped file URLs.

Likely invalid or redundant comment.

Tools
LanguageTool

[duplication] ~8-~8: Possible typo: you repeated a word
Context: ...ocumentConverter#convert` options. ### Fixed * Fixed that signed URLs now work with ~ in the...

(ENGLISH_WORD_REPEAT_RULE)

@vipulnsward vipulnsward merged commit 6aa292d into main Jul 6, 2024
10 checks passed
@vipulnsward vipulnsward deleted the gh-167 branch July 6, 2024 10:18
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.

Signed URLs don't work with nth file type notation for files within a group
1 participant