Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/ac/simons/oembed/OembedEndpoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ 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());
if (this.getEndpoint().toLowerCase().contains("{format}")) {
uri = this.getEndpoint().replaceAll(Pattern.quote("{format}"), this.getFormat().toString());
}
else {
uri = this.getEndpoint();
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ac/simons/oembed/OembedEndpointTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public void toApiUrlShouldWork() {
assertThat(oembedEndpoint.toApiUrl("https://biking.michael-simons.eu/tracks/1")).hasToString(
"https://biking.michael-simons.eu/oembed?format=json&url=https%3A%2F%2Fbiking.michael-simons.eu%2Ftracks%2F1&maxwidth=480&maxheight=360");

oembedEndpoint.setEndpoint("https://api.twitter.com/1.1/statuses/oembed.%{format}");
oembedEndpoint.setEndpoint("https://api.twitter.com/1.1/statuses/oembed.{format}");
oembedEndpoint.setFormat(Format.json);
oembedEndpoint.setMaxWidth(null);
oembedEndpoint.setMaxHeight(null);
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/ac/simons/oembed/OembedServiceTests.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public void findEndpointForShouldWorkAutodiscovery5() {
@Test
public void findEndpointForShouldWork() {
OembedEndpoint vimeo = new OembedEndpoint();
vimeo.setEndpoint("http://vimeo.com/api/oembed.%{format}");
vimeo.setEndpoint("http://vimeo.com/api/oembed.{format}");
vimeo.setUrlSchemes(Arrays.asList("https?://vimeo.com/groups/.+/videos/\\d+",
"https?://vimeo.com/channels/.+/\\d+", "https?://vimeo.com/\\d+"));

Expand Down