mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 11:17:25 +01:00
Make all gifcay id all lower case.
This commit is contained in:
parent
36c7cfcc6b
commit
6f64303df8
@ -403,7 +403,7 @@ public class ParsePost {
|
|||||||
if (gfycatId.contains("-")) {
|
if (gfycatId.contains("-")) {
|
||||||
gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
|
gfycatId = gfycatId.substring(0, gfycatId.indexOf('-'));
|
||||||
}
|
}
|
||||||
post.setGfycatId(gfycatId);
|
post.setGfycatId(gfycatId.toLowerCase());
|
||||||
} else if (authority != null && authority.contains("redgifs.com")) {
|
} else if (authority != null && authority.contains("redgifs.com")) {
|
||||||
String gfycatId = url.substring(url.lastIndexOf("/") + 1);
|
String gfycatId = url.substring(url.lastIndexOf("/") + 1);
|
||||||
if (gfycatId.contains("-")) {
|
if (gfycatId.contains("-")) {
|
||||||
@ -411,7 +411,7 @@ public class ParsePost {
|
|||||||
}
|
}
|
||||||
post.setIsRedgifs(true);
|
post.setIsRedgifs(true);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setGfycatId(gfycatId);
|
post.setGfycatId(gfycatId.toLowerCase());
|
||||||
}
|
}
|
||||||
} catch (IllegalArgumentException ignore) { }
|
} catch (IllegalArgumentException ignore) { }
|
||||||
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
} else if (post.getPostType() == Post.LINK_TYPE || post.getPostType() == Post.NO_PREVIEW_LINK_TYPE) {
|
||||||
@ -449,16 +449,21 @@ public class ParsePost {
|
|||||||
} else if (post.getPostType() == Post.LINK_TYPE) {
|
} else if (post.getPostType() == Post.LINK_TYPE) {
|
||||||
Uri uri = Uri.parse(url);
|
Uri uri = Uri.parse(url);
|
||||||
String authority = uri.getAuthority();
|
String authority = uri.getAuthority();
|
||||||
|
|
||||||
|
// Gyfcat ids must be lowercase to resolve to a video through the api, we are not
|
||||||
|
// guaranteed to get an id that is all lowercase.
|
||||||
|
String gfycatId = url.substring(url.lastIndexOf("/") + 1).toLowerCase();
|
||||||
|
|
||||||
if (authority != null && (authority.contains("gfycat.com"))) {
|
if (authority != null && (authority.contains("gfycat.com"))) {
|
||||||
post.setPostType(Post.VIDEO_TYPE);
|
post.setPostType(Post.VIDEO_TYPE);
|
||||||
post.setIsGfycat(true);
|
post.setIsGfycat(true);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setGfycatId(url.substring(url.lastIndexOf("/") + 1));
|
post.setGfycatId(gfycatId);
|
||||||
} else if (authority != null && authority.contains("redgifs.com")) {
|
} else if (authority != null && authority.contains("redgifs.com")) {
|
||||||
post.setPostType(Post.VIDEO_TYPE);
|
post.setPostType(Post.VIDEO_TYPE);
|
||||||
post.setIsRedgifs(true);
|
post.setIsRedgifs(true);
|
||||||
post.setVideoUrl(url);
|
post.setVideoUrl(url);
|
||||||
post.setGfycatId(url.substring(url.lastIndexOf("/") + 1));
|
post.setGfycatId(gfycatId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user