diff --git a/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java b/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java index c0f41c9cc4..4451b2bbc1 100644 --- a/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java +++ b/src/main/java/com/owncloud/android/providers/DocumentsStorageProvider.java @@ -337,16 +337,16 @@ public class DocumentsStorageProvider extends DocumentsProvider { @Override public String copyDocument(String sourceDocumentId, String targetParentDocumentId) throws FileNotFoundException { long sourceId = Long.parseLong(sourceDocumentId); - long targetId = Long.parseLong(targetParentDocumentId); + updateCurrentStorageManagerIfNeeded(sourceId); OCFile file = currentStorageManager.getFileById(sourceId); - OCFile targetFolder = currentStorageManager.getFileById(targetId); - if (file == null) { throw new FileNotFoundException("File " + sourceDocumentId + " not found!"); } + long targetId = Long.parseLong(targetParentDocumentId); + OCFile targetFolder = currentStorageManager.getFileById(targetId); if (targetFolder == null) { throw new FileNotFoundException("File " + targetParentDocumentId + " not found!"); }