Small fixes related to parsing and soring

Closes #96
This commit is contained in:
Balazs Toldi 2023-08-10 21:12:49 +02:00
parent 37ab47bc34
commit 7a39b2341b
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
2 changed files with 5 additions and 3 deletions

View File

@ -43,7 +43,7 @@ public class SortType {
TOP_TWELVE_HOURS("TopTwelveHour", "Top"),
TOP_DAY("TopDay", "Top"),
TOP_WEEK("TopWeek", "Top"),
TOP_MONTH("month", "Top"),
TOP_MONTH("TopMonth", "Top"),
TOP_THREE_MONTHS("TopThreeMonths", "Top"),
TOP_SIX_MONTHS("TopSixMonths", "Top"),
TOP_NINE_MONTHS("TopNineMonths", "Top"),

View File

@ -33,7 +33,6 @@ import java.util.concurrent.Executor;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import eu.toldi.infinityforlemmy.markdown.MarkdownUtils;
import eu.toldi.infinityforlemmy.postfilter.PostFilter;
import eu.toldi.infinityforlemmy.utils.JSONUtils;
import eu.toldi.infinityforlemmy.utils.LemmyUtils;
@ -219,6 +218,9 @@ public class ParsePost {
String authorAvatar = (!data.getJSONObject("creator").isNull("avatar")) ? data.getJSONObject("creator").getString("avatar") : null;
Uri uri = Uri.parse(url);
if (uri.getAuthority() == null) {
Log.e("ParsePost", "parseData:" + uri.toString());
}
String path = uri.getPath();
boolean isVideo = path.endsWith(".mp4") || path.endsWith(".webm") || path.endsWith(".gifv");
@ -364,7 +366,7 @@ public class ParsePost {
post.setPreviews(previews);
post.setVideoUrl(url);
} else if (uri.getAuthority().contains("imgur.com") && (path.endsWith(".gifv") || path.endsWith(".mp4"))) {
} else if (uri.getAuthority() != null && uri.getAuthority().contains("imgur.com") && (path.endsWith(".gifv") || path.endsWith(".mp4"))) {
// Imgur gifv/mp4
int postType = Post.VIDEO_TYPE;