From ae488615a4ca679708f4d01dfdcdbd480d5cf2b8 Mon Sep 17 00:00:00 2001 From: Stefan Schueller Date: Sun, 21 Jun 2020 19:13:25 +0200 Subject: [PATCH] https://github.com/sschueller/peertube-android/issues/143 --- app/src/main/java/net/schueller/peertube/intents/Intents.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/net/schueller/peertube/intents/Intents.java b/app/src/main/java/net/schueller/peertube/intents/Intents.java index acbede1..6b2dfe3 100644 --- a/app/src/main/java/net/schueller/peertube/intents/Intents.java +++ b/app/src/main/java/net/schueller/peertube/intents/Intents.java @@ -69,7 +69,9 @@ public class Intents { public static void Download(Context context, Video video) { String url = video.getFiles().get(0).getFileDownloadUrl(); - String destFilename = video.getName() + "." + MimeTypeMap.getFileExtensionFromUrl(URLUtil.guessFileName(url,null,null)); + // make sure it is a valid filename + String destFilename = video.getName().replaceAll("[^a-zA-Z0-9]", "_") + "." + MimeTypeMap.getFileExtensionFromUrl(URLUtil.guessFileName(url,null,null)); + //Toast.makeText(context, destFilename, Toast.LENGTH_LONG).show(); DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); request.setDescription(video.getDescription());