Stefan Schueller 2020-06-21 19:13:25 +02:00
parent c2eeaea5f0
commit ae488615a4

View File

@ -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());