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

replace relative protocol for discoverable endpoint #69

Closed

Conversation

slavone
Copy link

@slavone slavone commented Oct 1, 2017

If some service provides discoverable oembed link with relative protocol ("//example.com/oembed"), the url will be invalid and the request will crash

Example:

<link rel="alternate" type="application/json+oembed" href="//www.playbuzz.com/api/oembed/?url=https://www.playbuzz.com/qzeyrr10/plan-a-vacation-and-well-tell-you-what-job-you-should-have&amp;format=json">

This can be fixed by merging the request url with discovered api endpoint. Example:

irb(main):004:0> req = URI.parse('http://example.com/resource/123')
=> #<URI::HTTP http://example.com/resource/123>
irb(main):005:0> endpoint = URI.parse('//example.com/api/oembed')
=> #<URI::Generic //example.com/api/oembed>
irb(main):006:0> req.merge endpoint
=> #<URI::HTTP http://example.com/api/oembed>

@coveralls
Copy link

coveralls commented Oct 2, 2017

Coverage Status

Coverage remained the same at 95.215% when pulling 70825fa on slavone:fix/replace-relative-protocol into cd3f353 on ruby-oembed:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage remained the same at 95.215% when pulling 70825fa on slavone:fix/replace-relative-protocol into cd3f353 on ruby-oembed:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 95.219% when pulling b7dd678 on slavone:fix/replace-relative-protocol into cd3f353 on ruby-oembed:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage increased (+0.003%) to 95.219% when pulling b7dd678 on slavone:fix/replace-relative-protocol into cd3f353 on ruby-oembed:master.

@coveralls
Copy link

coveralls commented Oct 18, 2017

Coverage Status

Coverage increased (+0.003%) to 95.219% when pulling b7dd678 on slavone:fix/replace-relative-protocol into cd3f353 on ruby-oembed:master.

@slavone slavone closed this May 5, 2022
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.

None yet

2 participants