Skip to content

Commit 73e3d28

Browse files
committed
Fix media isVideo/isValidImage/... utils method
1 parent 3ed94cf commit 73e3d28

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

WordPressUtils/src/main/java/org/wordpress/android/util/MediaUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,23 @@ public static boolean isValidImage(String url) {
3333
if (url == null) {
3434
return false;
3535
}
36-
36+
url = url.toLowerCase();
3737
return url.endsWith(".png") || url.endsWith(".jpg") || url.endsWith(".jpeg") || url.endsWith(".gif");
3838
}
3939

4040
public static boolean isDocument(String url) {
4141
if (url == null) {
4242
return false;
4343
}
44-
44+
url = url.toLowerCase();
4545
return url.endsWith(".doc") || url.endsWith(".docx") || url.endsWith(".odt") || url.endsWith(".pdf");
4646
}
4747

4848
public static boolean isPowerpoint(String url) {
4949
if (url == null) {
5050
return false;
5151
}
52-
52+
url = url.toLowerCase();
5353
return url.endsWith(".ppt") || url.endsWith(".pptx") || url.endsWith(".pps") || url.endsWith(".ppsx") ||
5454
url.endsWith(".key");
5555
}
@@ -58,14 +58,15 @@ public static boolean isSpreadsheet(String url) {
5858
if (url == null) {
5959
return false;
6060
}
61-
61+
url = url.toLowerCase();
6262
return url.endsWith(".xls") || url.endsWith(".xlsx");
6363
}
6464

6565
public static boolean isVideo(String url) {
6666
if (url == null) {
6767
return false;
6868
}
69+
url = url.toLowerCase();
6970
return url.endsWith(".ogv") || url.endsWith(".mp4") || url.endsWith(".m4v") || url.endsWith(".mov") ||
7071
url.endsWith(".wmv") || url.endsWith(".avi") || url.endsWith(".mpg") || url.endsWith(".3gp") ||
7172
url.endsWith(".3g2") || url.contains("video");
@@ -75,6 +76,7 @@ public static boolean isAudio(String url) {
7576
if (url == null) {
7677
return false;
7778
}
79+
url = url.toLowerCase();
7880
return url.endsWith(".mp3") || url.endsWith(".ogg") || url.endsWith(".wav") || url.endsWith(".wma") ||
7981
url.endsWith(".aiff") || url.endsWith(".aif") || url.endsWith(".aac") || url.endsWith(".m4a");
8082
}

0 commit comments

Comments
 (0)