Make sure feed media is of the right content type
This commit is contained in:
parent
844dd17cb1
commit
e7cc82fdfb
|
@ -27,6 +27,7 @@ import java.util.Date;
|
|||
import de.danoeh.antennapod.core.ClientConfig;
|
||||
import de.danoeh.antennapod.core.R;
|
||||
import de.danoeh.antennapod.core.feed.FeedImage;
|
||||
import de.danoeh.antennapod.core.feed.FeedMedia;
|
||||
import de.danoeh.antennapod.core.util.DateUtils;
|
||||
import de.danoeh.antennapod.core.util.DownloadError;
|
||||
import de.danoeh.antennapod.core.util.StorageUtils;
|
||||
|
@ -117,6 +118,15 @@ public class HttpDownloader extends Downloader {
|
|||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
if(request.getFeedfileType() == FeedMedia.FEEDFILETYPE_FEEDMEDIA) {
|
||||
String contentType = response.header("Content-Type");
|
||||
if(!contentType.startsWith("audio/") && !contentType.startsWith("video/")) {
|
||||
onFail(DownloadError.ERROR_FILE_TYPE, null);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
responseBody = response.body();
|
||||
String contentEncodingHeader = response.header("Content-Encoding");
|
||||
boolean isGzip = false;
|
||||
|
|
|
@ -19,7 +19,8 @@ public enum DownloadError {
|
|||
ERROR_UNKNOWN_HOST(11, R.string.download_error_unknown_host),
|
||||
ERROR_REQUEST_ERROR(12, R.string.download_error_request_error),
|
||||
ERROR_DB_ACCESS_ERROR(13, R.string.download_error_db_access),
|
||||
ERROR_UNAUTHORIZED(14, R.string.download_error_unauthorized);
|
||||
ERROR_UNAUTHORIZED(14, R.string.download_error_unauthorized),
|
||||
ERROR_FILE_TYPE(15, R.string.download_error_file_type_type);
|
||||
|
||||
private final int code;
|
||||
private final int resId;
|
||||
|
|
|
@ -178,6 +178,7 @@
|
|||
<string name="download_error_connection_error">Connection Error</string>
|
||||
<string name="download_error_unknown_host">Unknown Host</string>
|
||||
<string name="download_error_unauthorized">Authentication Error</string>
|
||||
<string name="download_error_file_type_type">File Type Error</string>
|
||||
<string name="cancel_all_downloads_label">Cancel all downloads</string>
|
||||
<string name="download_canceled_msg">Download canceled</string>
|
||||
<string name="download_canceled_autodownload_enabled_msg">Download canceled\nDisabled <i>Auto Download</i> for this item</string>
|
||||
|
|
Loading…
Reference in New Issue