-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Hello, @michael-simons
thank you for this great library. I recently discovered it and have been using it successfully in my project.
While integrating it, I implemented logic that reads provider-specific YAML files from the official oEmbed providers repository
(https://github.com/iamcal/oembed/tree/master/providers) and creates OembedEndpoint objects based on those definitions.
During this process, I noticed that some providers (for example, Vimeo: https://vimeo.com/api/oembed.{format}) include a .{format} placeholder directly in the URL.
However, in the source code, the URL parsing logic appears to expect the placeholder to be written as .%{format} instead of .{format}
Because of this difference, the following error occurs when using URLs that contain .{format}:
ac.simons.oembed.OembedException: Illegal character in path at index 44:
https://api.twitter.com/1.1/statuses/oembed.{format}As a workaround, I am currently converting .{format} to .%{format} manually when such URLs are encountered.
I wanted to ask whether the % character in .%{format} is intentional.
If this is by design, it might be helpful to clarify this expectation in the comments or documentation.
/**
* Updates the endpoint of this provider. Any {@code .{format}} parameter will be
* recognized.
* @param endpoint the new endpoint
*/
public void setEndpoint(final String endpoint) {
this.endpoint = endpoint;
}If not, it seems that removing the % from the source code could improve compatibility with the provider definitions used in the official oEmbed repository.
public URI toApiUrl(final String url) {
String uri;
final List<NameValuePair> query = new ArrayList<>();
if (this.getEndpoint().toLowerCase().contains("%{format}")) {
uri = this.getEndpoint().replaceAll(Pattern.quote("%{format}"), this.getFormat().toString());
}
...
}Thank you very much for your time and for maintaining this project.
I appreciate you taking a look when you have a chance.
Best regards