mirror of
https://github.com/nextcloud/android.git
synced 2024-11-23 05:35:39 +03:00
Bug fixed (and some refactoring): crash on local removal of a folder
This commit is contained in:
parent
c20d7ef4ad
commit
0f39ff841a
2 changed files with 6 additions and 7 deletions
|
@ -486,8 +486,12 @@ public class FileDataStorageManager {
|
|||
}
|
||||
success &= (deleted > 0);
|
||||
}
|
||||
if (removeLocalCopy && file.isDown() && file.getStoragePath() != null && success) {
|
||||
success = new File(file.getStoragePath()).delete();
|
||||
String localPath = file.getStoragePath();
|
||||
if (removeLocalCopy && file.isDown() && localPath != null && success) {
|
||||
success = new File(localPath).delete();
|
||||
if (success) {
|
||||
triggerMediaScan(localPath);
|
||||
}
|
||||
if (!removeDBData && success) {
|
||||
// maybe unnecessary, but should be checked TODO remove if unnecessary
|
||||
file.setStoragePath(null);
|
||||
|
|
|
@ -96,7 +96,6 @@ implements ConfirmationDialogFragmentListener {
|
|||
FileDataStorageManager storageManager = cg.getStorageManager();
|
||||
if (storageManager.getFileById(mTargetFile.getFileId()) != null) {
|
||||
cg.getFileOperationsHelper().removeFile(mTargetFile, false);
|
||||
storageManager.triggerMediaScan(mTargetFile.getStoragePath());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,7 +104,6 @@ implements ConfirmationDialogFragmentListener {
|
|||
*/
|
||||
@Override
|
||||
public void onNeutral(String callerTag) {
|
||||
String path = mTargetFile.getStoragePath();
|
||||
ComponentsGetter cg = (ComponentsGetter)getSherlockActivity();
|
||||
cg.getFileOperationsHelper().removeFile(mTargetFile, true);
|
||||
|
||||
|
@ -135,9 +133,6 @@ implements ConfirmationDialogFragmentListener {
|
|||
folder.setEtag("");
|
||||
storageManager.saveFile(folder);
|
||||
}
|
||||
|
||||
// Trigger MediaScan
|
||||
storageManager.triggerMediaScan(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue