diff options
4 files changed, 27 insertions, 7 deletions
diff --git a/build.gradle b/build.gradle index 22774c68e..a67ca5e83 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ buildscript { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:0.6.+' + classpath 'com.android.tools.build:gradle:0.7.+' } } apply plugin: 'android' @@ -38,7 +38,7 @@ dependencies { android { compileSdkVersion 19 - buildToolsVersion "19.0.0" + buildToolsVersion "19.0.1" defaultConfig { minSdkVersion 10 @@ -94,4 +94,9 @@ android { signingConfig signingConfigs.releaseConfig } } + + packagingOptions { + exclude 'META-INF/LICENSE.txt' + exclude 'META-INF/NOTICE.txt' + } } diff --git a/src/de/danoeh/antennapod/feed/FeedItem.java b/src/de/danoeh/antennapod/feed/FeedItem.java index a80460ece..9b9375f2e 100644 --- a/src/de/danoeh/antennapod/feed/FeedItem.java +++ b/src/de/danoeh/antennapod/feed/FeedItem.java @@ -80,7 +80,7 @@ public class FeedItem extends FeedComponent implements } if (other.media != null) { if (media == null) { - media = other.media; + setMedia(other.media); } else if (media.compareWithOther(other)) { media.updateFromOther(other); } diff --git a/src/de/danoeh/antennapod/service/download/HttpDownloader.java b/src/de/danoeh/antennapod/service/download/HttpDownloader.java index 582fb9575..94cf01188 100644 --- a/src/de/danoeh/antennapod/service/download/HttpDownloader.java +++ b/src/de/danoeh/antennapod/service/download/HttpDownloader.java @@ -6,9 +6,7 @@ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.net.HttpURLConnection; -import java.net.SocketTimeoutException; -import java.net.UnknownHostException; +import java.net.*; import org.apache.commons.io.IOUtils; import org.apache.http.Header; @@ -58,13 +56,24 @@ public class HttpDownloader extends Downloader { return httpClient; } + private URI getURIFromRequestUrl(String source) { + try { + URL url = new URL(source); + return new URI(url.getProtocol(), url.getUserInfo(), url.getHost(), url.getPort(), url.getPath(), url.getQuery(), url.getRef()); + } catch (MalformedURLException e) { + throw new IllegalArgumentException(e); + } catch (URISyntaxException e) { + throw new IllegalArgumentException(e); + } + } + @Override protected void download() { DefaultHttpClient httpClient = null; BufferedOutputStream out = null; InputStream connection = null; try { - HttpGet httpGet = new HttpGet(request.getSource()); + HttpGet httpGet = new HttpGet(getURIFromRequestUrl(request.getSource())); httpClient = createHttpClient(); HttpResponse response = httpClient.execute(httpGet); HttpEntity httpEntity = response.getEntity(); diff --git a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java b/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java index 8df35ce67..5506a3bc9 100644 --- a/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java +++ b/src/instrumentationTest/de/test/antennapod/service/download/HttpDownloaderTest.java @@ -108,6 +108,12 @@ public class HttpDownloaderTest extends InstrumentationTestCase { assertFalse(new File(feedFile.getFile_url()).exists()); } + /* TODO: replace with smaller test file + public void testUrlWithSpaces() { + download("http://acedl.noxsolutions.com/ace/Don't Call Salman Rushdie Sneezy in Finland.mp3", "testUrlWithSpaces", true); + } + */ + private static class FeedFileImpl extends FeedFile { public FeedFileImpl(String download_url) { super(null, download_url, false); |