From f45a841caff20692586e19933ed1571d3e6cbf21 Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Mon, 27 Oct 2014 21:47:17 +0100 Subject: fixed url parsing --- src/eu/siacs/conversations/entities/Message.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index a089dd64..dd88c126 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -383,7 +383,12 @@ public class Message extends AbstractEntity { return false; } 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("\\."); if (extensionParts.length == 2 && Arrays.asList(Downloadable.VALID_EXTENSIONS).contains( -- cgit v1.2.3