Skip to content
Snippets Groups Projects
Commit cb5c7ebf authored by Geoffrey Métais's avatar Geoffrey Métais
Browse files

Check extension on filename instead of media title

(cherry picked from commit 90f0eb3c)
parent c454d882
No related branches found
No related tags found
No related merge requests found
......@@ -161,22 +161,17 @@ public class MediaWrapper implements Parcelable {
if (mType != TYPE_ALL)
return;
String fileExt = null;
int dotIndex = mTitle != null ? mTitle.lastIndexOf(".") : -1;
if (dotIndex != -1) {
fileExt = mTitle.substring(dotIndex).toLowerCase(Locale.ENGLISH);
} else {
final int index = mUri.toString().indexOf('?');
String location;
if (index == -1)
location = mUri.toString();
else
location = mUri.toString().substring(0, index);
dotIndex = location.lastIndexOf(".");
if (dotIndex != -1)
fileExt = location.substring(dotIndex).toLowerCase(Locale.ENGLISH);
}
String fileExt = null, filename = mUri.getLastPathSegment();
if (filename == null)
return;
final int index = filename.indexOf('?');
if (index != -1)
filename = filename.substring(0, index);
index = filename.lastIndexOf(".");
if (index != -1)
fileExt = filename.substring(index).toLowerCase(Locale.ENGLISH);
if (!TextUtils.isEmpty(fileExt)) {
if (Extensions.VIDEO.contains(fileExt)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment