Commit 2b8d1c85 authored by Felix Paul Kühne's avatar Felix Paul Kühne
Browse files

Download Controller: increase protection against unsupported downloads

parent cb90d610
......@@ -13,6 +13,7 @@
#import "VLCAppDelegate.h"
#import "UIBarButtonItem+Theme.h"
#import "WhiteRaccoon.h"
#import "NSString+SupportedMedia.h"
#define kVLCDownloadViaHTTP 1
#define kVLCDownloadViaFTP 2
......@@ -75,11 +76,16 @@
if ([self.urlField.text length] > 0) {
NSURL *URLtoSave = [NSURL URLWithString:self.urlField.text];
if (([URLtoSave.scheme isEqualToString:@"http"] || [URLtoSave.scheme isEqualToString:@"https"] || [URLtoSave.scheme isEqualToString:@"ftp"]) && ![URLtoSave.lastPathComponent.pathExtension isEqualToString:@""]) {
[_currentDownloads addObject:URLtoSave];
self.urlField.text = @"";
[self.downloadsTable reloadData];
[self _triggerNextDownload];
if ([URLtoSave.lastPathComponent isSupportedFormat]) {
[_currentDownloads addObject:URLtoSave];
self.urlField.text = @"";
[self.downloadsTable reloadData];
[self _triggerNextDownload];
} else {
UIAlertView * alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"FILE_NOT_SUPPORTED", @"") message:[NSString stringWithFormat:NSLocalizedString(@"FILE_NOT_SUPPORTED", @""), URLtoSave.lastPathComponent] delegate:self cancelButtonTitle:NSLocalizedString(@"BUTTON_CANCEL", @"") otherButtonTitles:nil];
[alert show];
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment