diff --git a/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java b/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java index 6f6c42446..131e4912d 100644 --- a/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java +++ b/library/src/androidTest/java/com/owncloud/android/CreateFolderRemoteOperationIT.java @@ -75,7 +75,7 @@ public void setUp() { public void testCreateFolder() { String remotePath = mFullPath2FolderBase; mCreatedFolderPaths.add(remotePath); - RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); + RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); assertTrue(result.isSuccess()); // Create Subfolder @@ -89,13 +89,13 @@ public void testCreateFolder() { public void testFileID() { String remotePath = mFullPath2FolderBase + "/" + RandomStringGenerator.make(TAG_LENGTH); mCreatedFolderPaths.add(remotePath); - RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); + RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); assertTrue(result.isSuccess()); RemoteOperationResult readResult = new ReadFileRemoteOperation(remotePath).execute(client); assertTrue(readResult.isSuccess()); - Long remoteId = ((RemoteFile) readResult.getData().get(0)).getLocalId(); + String remoteId = ((RemoteFile) readResult.getData().get(0)).getRemoteId(); assertEquals(result.getResultData(), remoteId); } @@ -106,7 +106,7 @@ public void testFileID() { @Test public void testCreateFolderSpecialCharactersOnNewVersion() { String remotePath = mFullPath2FolderBase + "_<"; - RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); + RemoteOperationResult result = new CreateFolderRemoteOperation(remotePath, true).execute(client); assertTrue("Remote path: " + remotePath, result.isSuccess()); remotePath = mFullPath2FolderBase + "_>"; diff --git a/library/src/main/java/com/owncloud/android/lib/resources/files/CreateFolderRemoteOperation.java b/library/src/main/java/com/owncloud/android/lib/resources/files/CreateFolderRemoteOperation.java index 975c8a59c..8e4be6a90 100644 --- a/library/src/main/java/com/owncloud/android/lib/resources/files/CreateFolderRemoteOperation.java +++ b/library/src/main/java/com/owncloud/android/lib/resources/files/CreateFolderRemoteOperation.java @@ -42,7 +42,7 @@ * @author David A. Velasco * @author masensio */ -public class CreateFolderRemoteOperation extends RemoteOperation { +public class CreateFolderRemoteOperation extends RemoteOperation { private static final String TAG = CreateFolderRemoteOperation.class.getSimpleName(); @@ -77,8 +77,8 @@ public CreateFolderRemoteOperation(String remotePath, boolean createFullPath, St * @param client Client object to communicate with the remote ownCloud server. */ @Override - protected RemoteOperationResult run(OwnCloudClient client) { - RemoteOperationResult result; + protected RemoteOperationResult run(OwnCloudClient client) { + RemoteOperationResult result; result = createFolder(client); if (!result.isSuccess() && createFullPath && @@ -94,8 +94,8 @@ protected RemoteOperationResult run(OwnCloudClient client) { } - private RemoteOperationResult createFolder(OwnCloudClient client) { - RemoteOperationResult result; + private RemoteOperationResult createFolder(OwnCloudClient client) { + RemoteOperationResult result; MkColMethod mkCol = null; try { mkCol = new MkColMethod(client.getFilesDavUri(remotePath)); @@ -114,11 +114,9 @@ private RemoteOperationResult createFolder(OwnCloudClient client) { Header cookieHeader = mkCol.getResponseHeader("Set-Cookie"); if (fileIdHeader != null && cookieHeader != null) { - String instanceId = cookieHeader.getValue().split("=")[0]; String fileId = fileIdHeader.getValue(); - String id = fileId.replace(instanceId, ""); - result.setResultData(Long.valueOf(id)); + result.setResultData(fileId); } else { result.setResultData(null); } @@ -137,8 +135,8 @@ private RemoteOperationResult createFolder(OwnCloudClient client) { return result; } - private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) { - RemoteOperation operation = new CreateFolderRemoteOperation(parentPath, createFullPath); + private RemoteOperationResult createParentFolder(String parentPath, OwnCloudClient client) { + RemoteOperation operation = new CreateFolderRemoteOperation(parentPath, createFullPath); return operation.execute(client); }