kongzue / kongzue/BaseOkHttpV3

文件下载地址若失效,会走onDownloadSuccess回调

Open
#22 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
227
Forks
37
PR merge metrics
No merged PRs in 30d

Description

测试连接:https://down.wss.show/3dyl80b/9/0d/90do3dyl80b?cdn_sign=1660120096-5-0-bcca8f1d079bc819fefda02d5acb3d9f&exp=240&response-content-disposition=attachment%3B%20filename%3D%22%E6%B5%8B%E8%AF%95111_1.0.1.apk%22%3B%20filename%2A%3Dutf-8%27%27%25E6%25B5%258B%25E8%25AF%2595111_1.0.1.apk

http错误码为403,但是会走`onDownloadSuccess()`回调,可以修复下

代码如下:
```
HttpRequest.DOWNLOAD(
ActivityUtils.getTopActivity(), downloadUrl,
file,
new OnDownloadListener() {
@Override
public void onDownloadSuccess(File file) {
progressDialog.dismiss();
if (file.length() > 0) {
//下载完毕后安装apk文件
AppUtils.installApp(file);
} else {
ToastUtils.showShort("apk文件大小为0KB,更新失败!");
}
}

@Override
public void onDownloading(int progress) {
KLog.d("下载进度:" + progress);
//更新进度
progressDialog.setProgress(progress);
}

@Override
public void onDownloadFailed(Exception e) {
ToastUtils.showShort("下载失败,原因:" + e.getMessage());
}
}
);
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing the HttpRequest.DOWNLOAD entry point and the OnDownloadListener callback handling. Reproduce the issue with the provided URL, which returns HTTP 403, and verify that failed responses invoke onDownloadFailed rather than onDownloadSuccess; done when the callback behavior matches the response status.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.