From 4e0d5ebd04e6b4a78400f1274beab83933071954 Mon Sep 17 00:00:00 2001 From: Steven Schoen Date: Sat, 5 Sep 2015 01:29:59 -0400 Subject: [PATCH] Fix filename generation from URL --- Emoji Switcher/build.gradle | 4 ++-- .../stevenschoen/emojiswitcher/EmojiSwitcherUtils.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Emoji Switcher/build.gradle b/Emoji Switcher/build.gradle index 4fafd9a..a570081 100644 --- a/Emoji Switcher/build.gradle +++ b/Emoji Switcher/build.gradle @@ -7,8 +7,8 @@ android { defaultConfig { minSdkVersion 19 targetSdkVersion 23 - versionCode 13 - versionName "2.0" + versionCode 14 + versionName "2.0.1" } compileOptions { diff --git a/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java b/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java index 9a5bafc..af8cf4d 100644 --- a/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java +++ b/Emoji Switcher/src/main/java/com/stevenschoen/emojiswitcher/EmojiSwitcherUtils.java @@ -251,7 +251,13 @@ public static boolean isDownloaded(EmojiSet emojiSet) throws IOException { } private static String filenameFromUrl(String url) { - return FilenameUtils.getName(url); + String filename = FilenameUtils.getName(url); + int indexOfParam = filename.indexOf('?'); + if (indexOfParam != -1) { + return filename.substring(0, indexOfParam); + } else { + return filename; + } } public static String filePath(Context context, EmojiSetListing listing) {