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

Squeeze multiple slashes in URLs #62

Merged
merged 1 commit into from
Sep 7, 2024
Merged

Conversation

tagliala
Copy link
Member

@tagliala tagliala commented Sep 7, 2024

Ruby 2.5 has removed the normalization of multiple slashes in URLs, so you can get 301 redirect errors if you run for example Model.get('/batch/id').

2.4 > URI.parse("http://example.org").merge('people//batch///id')
 => #<URI::HTTP http://example.org/people/batch/id> 
                                         ^     ^
2.5 > URI.parse("http://example.org").merge('people//batch///id')
 => #<URI::HTTP http://example.org/people//batch///id> 
                                         ^^     ^^^

In Hawk's use case, it should be safe to assume that paths should be squeezed, but since this can be considered a breaking change, this commit also bumps the major version number

Ref: https://bugs.ruby-lang.org/issues/8352

Ruby 2.5 has removed the normalization of multiple slashes in URLs, so
you can get 301 redirect errors if you run for example
`Model.get('/batch/id')`.

```
2.4 > URI.parse("http://example.org").merge('people//batch///id')
 => #<URI::HTTP http://example.org/people/batch/id> 
                                         ^     ^
```

```
2.5 > URI.parse("http://example.org").merge('people//batch///id')
 => #<URI::HTTP http://example.org/people//batch///id> 
                                         ^^     ^^^
```

In Hawk's use case, it should be safe to assume that paths should be
squeezed, but since this can be considered a breaking change, this
commit also bumps the major version number

Ref: https://bugs.ruby-lang.org/issues/8352
@tagliala tagliala force-pushed the bugfix/squeeze-double-slashes branch from ad8507e to bd07aa2 Compare September 7, 2024 18:00
@tagliala tagliala mentioned this pull request Sep 7, 2024
@tagliala tagliala merged commit 4205e06 into master Sep 7, 2024
18 checks passed
@tagliala tagliala deleted the bugfix/squeeze-double-slashes branch September 7, 2024 18:02
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.

1 participant