fixed url parsing

This commit is contained in:
iNPUTmice 2014-10-27 21:47:17 +01:00
parent da822ebae8
commit f45a841caf
1 changed files with 6 additions and 1 deletions

View File

@ -383,7 +383,12 @@ public class Message extends AbstractEntity {
return false; return false;
} }
String[] pathParts = url.getPath().split("/"); String[] pathParts = url.getPath().split("/");
String filename = pathParts[pathParts.length - 1]; String filename;
if (pathParts.length > 0) {
filename = pathParts[pathParts.length - 1];
} else {
filename = pathParts[0];
}
String[] extensionParts = filename.split("\\."); String[] extensionParts = filename.split("\\.");
if (extensionParts.length == 2 if (extensionParts.length == 2
&& Arrays.asList(Downloadable.VALID_EXTENSIONS).contains( && Arrays.asList(Downloadable.VALID_EXTENSIONS).contains(