mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
Merge pull request #7649 from nextcloud/ezaquarii/fix-upload-via-share-make-mtime-read-optional
Fix upload by sharing link with defensive check during mtime read
This commit is contained in:
commit
69af47857b
1 changed files with 6 additions and 4 deletions
|
@ -152,9 +152,11 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
|
|||
null,
|
||||
null)) {
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
lastModified = cursor.getLong(
|
||||
cursor.getColumnIndexOrThrow(
|
||||
DocumentsContract.Document.COLUMN_LAST_MODIFIED));
|
||||
// this check prevents a crash when last modification time is not available on certain phones
|
||||
int columnIndex = cursor.getColumnIndex(DocumentsContract.Document.COLUMN_LAST_MODIFIED);
|
||||
if (columnIndex >= 0) {
|
||||
lastModified = cursor.getLong(columnIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -173,7 +175,7 @@ public class CopyAndUploadContentUrisTask extends AsyncTask<Object, Void, Result
|
|||
while ((count = inputStream.read(buffer)) > 0) {
|
||||
outputStream.write(buffer, 0, count);
|
||||
}
|
||||
|
||||
|
||||
if (lastModified != 0) {
|
||||
try {
|
||||
if (!cacheFile.setLastModified(lastModified)) {
|
||||
|
|
Loading…
Reference in a new issue