mirror of
				https://github.com/owncloud/android-library.git
				synced 2025-10-31 02:17:41 +00:00 
			
		
		
		
	Fix folder creation
This commit is contained in:
		
							parent
							
								
									234add959a
								
							
						
					
					
						commit
						495e3321e2
					
				| @ -72,7 +72,15 @@ public class CreateRemoteFolderOperation extends RemoteOperation { | ||||
|      */ | ||||
|     @Override | ||||
|     protected RemoteOperationResult run(OwnCloudClient client) { | ||||
|         return new RemoteOperationResult<>(ResultCode.INVALID_CHARACTER_IN_NAME); | ||||
|         RemoteOperationResult result = createFolder(client); | ||||
|         if (!result.isSuccess() && mCreateFullPath && | ||||
|                 RemoteOperationResult.ResultCode.CONFLICT == result.getCode()) { | ||||
|             result = createParentFolder(FileUtils.getParentPath(mRemotePath), client); | ||||
|             if (result.isSuccess()) { | ||||
|                 result = createFolder(client);    // second (and last) try | ||||
|             } | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
| 
 | ||||
|     private RemoteOperationResult createFolder(OwnCloudClient client) { | ||||
|  | ||||
| @ -66,4 +66,21 @@ public class FileUtils { | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Validate the fileName to detect if contains any forbidden character: / , \ , < , > , | ||||
|      * : , " , | , ? , * | ||||
|      * | ||||
|      * @param fileName | ||||
|      * @return | ||||
|      */ | ||||
|     public static boolean isValidName(String fileName) { | ||||
|         boolean result = true; | ||||
| 
 | ||||
|         Log_OC.d(TAG, "fileName =======" + fileName); | ||||
|         if (fileName.contains(PATH_SEPARATOR)) { | ||||
|             result = false; | ||||
|         } | ||||
|         return result; | ||||
|     } | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user