[BUG] Can't manually retry a failed camera upload
- Dominant language
- Kotlin
- Stars
- 4.2k
- Forks
- 3.1k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 7
Description
Hi,
It looks like in one of the recent versions you guys started to use content:// URIs instead of local paths to handle camera uploads.
This works fine, but when an upload fails for some reason (like, the server is unavailable or no permissions to write to the upload directory), clicking on the upload in the Uploads list to retry it shows a "The file was not found in the local file system" message and does nothing.
From my quick debugging session, I found out that it happens because the code in the OnClickListener that's set in ExpandableUploadListAdapter.getView still expects the source path to be local and uses File.exists on it:
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
File file = new File(upload.getLocalPath());
if (file.exists()) {
TransferRequester requester = new TransferRequester();
requester.retry(mParentActivity, upload, false);
refreshView();
} else {
Snackbar snackbar = Snackbar.make(
v.getRootView().findViewById(android.R.id.content),
mParentActivity.getString(R.string.local_file_not_found_toast),
Snackbar.LENGTH_LONG
);
snackbar.show();
}
}
});
Although I fixed it for myself by also trying to pass the path to DocumentFile.fromSingleUri, but I don't think I have enough overall knowledge of the project to suggest a good PR for this, so just letting you guys know.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.