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 and refactor makeAbsoluteStr #249

Merged
merged 2 commits into from
Jan 18, 2021
Merged

Conversation

Kdecherf
Copy link
Collaborator

@Kdecherf Kdecherf commented Jan 16, 2021

This commit achieves several things:

  • Remove str_replace() as removing the path from the base misleads the
    resolver, e.g. makeAbsoluteStr(http://example.org/?d=hello,img.jpg) actually leads to
    http:img.jpg instead of http://example.org/img.jpg
  • Refactor the whole method to simplify it and rely more on Uri
  • Update the test with path containing leading double slashes as we
    should keep the same behavior than browsers

This commit achieves several things:
- Remove `str_replace()` as removing the path from the base misleads the
  resolver, e.g. (http://example.org/?d=hello,img.jpg) actually leads to
  'http:img.jpg' instead of 'http://example.org/img.jpg'
- Refactor the whole method to simplify it and rely more on Uri
- Update the test with path containing leading double slashes as we
  should keep the same behavior than browsers

Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
Signed-off-by: Kevin Decherf <kevin@kdecherf.com>
@coveralls
Copy link

Coverage Status

Coverage remained the same at 96.456% when pulling 33e6758 on Kdecherf:fix/absoluteStr into 987aa6c on j0k3r:master.

@j0k3r j0k3r merged commit 07c7f19 into j0k3r:master Jan 18, 2021
@Kdecherf Kdecherf deleted the fix/absoluteStr branch January 19, 2021 22:59
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.

3 participants