laoyuyu 5 years ago
parent 062f124cae
commit a5fc5d0bcf
  1. 10
      Aria/src/main/java/com/arialyy/aria/core/AriaManager.java
  2. 9
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpFileInfoThread.java
  3. 1
      README.md
  4. 2
      build.gradle

@ -161,13 +161,11 @@ import org.xml.sax.SAXException;
* 初始化数据库 * 初始化数据库
*/ */
private void initDb(Context context) { private void initDb(Context context) {
// 这个地方错误了,获取数据库路径见:https://www.jianshu.com/p/815c9efc5449
String oldDbName = "AriaLyyDb"; String oldDbName = "AriaLyyDb";
String oldDbPath = context.getDatabasePath(oldDbName).getPath(); File oldDbFile = context.getDatabasePath(oldDbName);
File db = new File(oldDbPath); if (oldDbFile != null && oldDbFile.exists()) {
File dbConfig = new File(String.format("%s/%s", db.getParent(), "AriaLyyDb-journal")); File dbConfig = new File(String.format("%s/%s", oldDbFile.getParent(), "AriaLyyDb-journal"));
if (db.exists()) { oldDbFile.renameTo(new File(String.format("%s/%s", oldDbFile.getParent(), "AndroidAria.db")));
db.renameTo(new File(String.format("%s/%s", db.getParent(), "AndroidAria.db")));
// 如果数据库是在/data/data/{packagename}/databases/下面,journal文件因权限问题将无法删除和重命名 // 如果数据库是在/data/data/{packagename}/databases/下面,journal文件因权限问题将无法删除和重命名
if (dbConfig.exists()) { if (dbConfig.exists()) {
dbConfig.delete(); dbConfig.delete();

@ -16,6 +16,7 @@
package com.arialyy.aria.core.download.downloader; package com.arialyy.aria.core.download.downloader;
import android.net.TrafficStats; import android.net.TrafficStats;
import android.net.Uri;
import android.os.Process; import android.os.Process;
import android.text.TextUtils; import android.text.TextUtils;
import com.arialyy.aria.core.AriaManager; import com.arialyy.aria.core.AriaManager;
@ -284,13 +285,17 @@ public class HttpFileInfoThread implements Runnable {
*/ */
private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException { private void handleUrlReTurn(HttpURLConnection conn, String newUrl) throws IOException {
ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】"); ALog.d(TAG, "30x跳转,新url为【" + newUrl + "】");
if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null") || !newUrl.startsWith( if (TextUtils.isEmpty(newUrl) || newUrl.equalsIgnoreCase("null")) {
"http")) {
if (onFileInfoCallback != null) { if (onFileInfoCallback != null) {
onFileInfoCallback.onFail(mEntity, new TaskException(TAG, "获取重定向链接失败"), false); onFileInfoCallback.onFail(mEntity, new TaskException(TAG, "获取重定向链接失败"), false);
} }
return; return;
} }
if (newUrl.startsWith("/")) {
Uri uri = Uri.parse(mEntity.getUrl());
newUrl = uri.getHost() + newUrl;
}
if (!CheckUtil.checkUrlNotThrow(newUrl)) { if (!CheckUtil.checkUrlNotThrow(newUrl)) {
failDownload(new TaskException(TAG, "下载失败,重定向url错误"), false); failDownload(new TaskException(TAG, "下载失败,重定向url错误"), false);
return; return;

@ -158,7 +158,6 @@ protected void onCreate(Bundle savedInstanceState) {
## 其他 ## 其他
有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br> 有任何问题,可以在[issues](https://github.com/AriaLyy/Aria/issues)给我留言反馈。</br>
在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br> 在提交问题前,希望你已经查看过[wiki](https://aria.laoyuyu.me/aria_doc/)或搜索过[issues](https://github.com/AriaLyy/Aria/issues)。</br>
交流群:524329160
*** ***

@ -43,7 +43,7 @@ task clean(type: Delete) {
ext { ext {
userOrg = 'arialyy' userOrg = 'arialyy'
groupId = 'com.arialyy.aria' groupId = 'com.arialyy.aria'
publishVersion = '3.6.5' publishVersion = '3.6.6_beta_1'
// publishVersion = '1.0.4' //FTP插件 // publishVersion = '1.0.4' //FTP插件
repoName='maven' repoName='maven'
desc = 'android 下载框架' desc = 'android 下载框架'

Loading…
Cancel
Save