New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

报告一个bug #100

Closed
candebbs opened this Issue Aug 25, 2017 · 4 comments

Comments

Projects
None yet
2 participants
@candebbs

candebbs commented Aug 25, 2017

下载一个文件,如果用户手动删除这个文件,如果再调用
Aria.upload(MyHadDownloadActivity.this).load(path).removeRecord();

因为文件不存在了,删除会造成崩溃,删除不了记录。

@AriaLyy

This comment has been minimized.

Owner

AriaLyy commented Aug 25, 2017

我这测试是正常的呢
能否提供一下logcat的日志?

@candebbs

This comment has been minimized.

candebbs commented Aug 25, 2017

java.lang.IllegalArgumentException: 上传文件不存在
at com.arialyy.aria.util.CheckUtil.checkUploadPath(CheckUtil.java:113)
at com.arialyy.aria.core.upload.UploadReceiver.load(UploadReceiver.java:47)

删除代码:
```
String path = ((DownloadEntity) mData.get(position)).getDownloadPath();
String name = ((DownloadEntity) mData.get(position)).getFileName();
LogUtil.e("pdfDownload", "had path " + path);

            if(id == R.id.pdf_open_bt) {

                Bundle bundle = new Bundle();
                bundle.putString("ebook_pdf", path);
                CommonUtil.startActivity(mContext, OpenPDFActivity.class, bundle);

            } else { // 删除pdf

                mData.remove(position);
                adapter.notifyDataSetChanged();

                if(!TextUtils.isEmpty(path)) {
                    if(FileUtils.fileIsExists(path)) {
                        Aria.upload(MyHadDownloadActivity.this).load(path).removeRecord();
                        FileUtils.delFile(path);
                    } else {
                        T.ss("数据出错,不能删除这条记录");
                    }
                }

            }
@AriaLyy

This comment has been minimized.

Owner

AriaLyy commented Aug 25, 2017

明白了,这是上传的一个逻辑问题,上传需要验证文件路径,才能进一步操作,就和判断下载地址是否为null一样,下个版本我专门增加一个不需要验证文件路径就可以删除记录的api吧。
现在你可以通过ORM模型直接删除:

UploadEntity entity = DbEntity.findFirst(UploadEntity.class, "filePath=?", filePath);
entity.deleteData();
@candebbs

This comment has been minimized.

candebbs commented Aug 25, 2017

好的

@candebbs candebbs closed this Aug 25, 2017

AriaLyy added a commit that referenced this issue Aug 31, 2017

@for1gumer for1gumer referenced this issue May 18, 2018

Closed

上传问题 #241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment