Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(path): correctly encode delimiters and relative paths #108
fix(path): correctly encode delimiters and relative paths #108
Changes from 12 commits
034f461
a9dfa33
d0dd15e
2954cab
7b7bce8
701020f
0c0c6ff
6d416df
bb4674e
6e9f72b
b912bfe
bd5bdec
efc732f
40ec089
3fd79ce
6fa3f2c
da3711c
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Not related to this PR, but it would be great if this state mutation could be removed by passing state in method calls, like you're doing with
sanitized_path
.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.
In the Variant PR, which shifts a lot of this escaping/encoding work to application boot, this would ideally be done in the Variant initializer: https://github.com/imgix/imgix-rb/pull/104/files#diff-f7f33d40dff4d8a40100ac8a68f7fab2e082a98a683b678c8ee04c1bc930102aR8
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.
Haven't had a chance to dig into #104 too much, but loved what I saw so far. Will definitely keep this in mind.
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.
Thanks for the suggestion @stevehodgkiss. I could not find any encoding issues when
to_url
is called multiple times on the samePath
, but I’m sure there will be edge cases that I haven’t thought of. Also, I think the ivar forsanitized_path
creates a more predictable experience for the user.I’ve implemented a solution based on your idea:
imgix-rb/lib/imgix/path.rb
Lines 17 to 27 in bd5bdec
Before these changes,
@path
was being modified in a way that was not explicit. There may be a case in the future where we want an@sanitized_path
var or asantize_path!
func, but for the purposes of this PR that is out of scope.There are a lot of improvements needed in this file and the library throughout, but I felt these changes have to least potential for producing breaking changes.
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.
Looks good! I take back my previous comment about "this would ideally be done in the Variant initializer". This can't be done there since it's about the Path itself, not the Variant.