Bläddra i källkod

http downloading: prettify some strings

(cherry picked from commit 5a2403c7d502cf965e259a87a5abe0733bc40649)
Felix Paul Kühne 9 år sedan
förälder
incheckning
6a9424bcfd
2 ändrade filer med 6 tillägg och 6 borttagningar
  1. 4 4
      Sources/VLCDownloadViewController.m
  2. 2 2
      Sources/VLCHTTPFileDownloader.m

+ 4 - 4
Sources/VLCDownloadViewController.m

@@ -166,8 +166,8 @@
             if (!_httpDownloader.downloadInProgress) {
                 _currentDownloadType = kVLCDownloadViaHTTP;
                 if (![_currentDownloadFilename.firstObject isEqualToString:@""]) {
-                    [_httpDownloader downloadFileFromURL:_currentDownloads.firstObject withFileName:_currentDownloadFilename.firstObject];
-                    _humanReadableFilename = [_currentDownloadFilename objectAtIndex:0];
+                    _humanReadableFilename = [[_currentDownloadFilename firstObject] stringByRemovingPercentEncoding];
+                    [_httpDownloader downloadFileFromURL:_currentDownloads.firstObject withFileName:_humanReadableFilename];
                 } else {
                     [_httpDownloader downloadFileFromURL:_currentDownloads.firstObject];
                     _humanReadableFilename = _httpDownloader.userReadableDownloadName;
@@ -386,9 +386,9 @@
 
     NSInteger row = indexPath.row;
     if ([_currentDownloadFilename[row] isEqualToString:@""])
-        cell.textLabel.text = [_currentDownloads[row] lastPathComponent];
+        cell.textLabel.text = [[_currentDownloads[row] lastPathComponent] stringByRemovingPercentEncoding];
     else
-        cell.textLabel.text = [_currentDownloadFilename[row] lastPathComponent];
+        cell.textLabel.text = [[_currentDownloadFilename[row] lastPathComponent] stringByRemovingPercentEncoding];
 
     cell.detailTextLabel.text = [_currentDownloads[row] absoluteString];
 

+ 2 - 2
Sources/VLCHTTPFileDownloader.m

@@ -49,7 +49,7 @@
     if (fileName)
         _fileName = fileName;
     else
-        _fileName = url.lastPathComponent;
+        _fileName = [url.lastPathComponent stringByRemovingPercentEncoding];
     _filePath = [basePath stringByAppendingPathComponent:_fileName];
     NSFileManager *fileManager = [NSFileManager defaultManager];
     if (![fileManager fileExistsAtPath:basePath])
@@ -82,7 +82,7 @@
 
         NSArray *searchPaths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
         NSString *basePath = [searchPaths[0] stringByAppendingPathComponent:@"Upload"];
-        _fileName = [URL lastPathComponent];
+        _fileName = [[URL lastPathComponent] stringByRemovingPercentEncoding];
         _filePath = [basePath stringByAppendingPathComponent:_fileName];
         if (![fileManager fileExistsAtPath:basePath])
             [fileManager createDirectoryAtPath:basePath withIntermediateDirectories:YES attributes:nil error:nil];