Marino Faggiana 6 years ago
parent
commit
55b0c4a73e

+ 4 - 4
iOSClient/Library/OCCommunicationLib/OCCommunication.m

@@ -2718,10 +2718,10 @@
 - (void)createLinkRichdocuments:(NSString *)serverPath fileID:(NSString *)fileID onCommunication:(OCCommunication *)sharedOCComunication successRequest:(void(^)(NSHTTPURLResponse *response, NSString *redirectedServer))successRequest  failureRequest:(void(^)(NSHTTPURLResponse *response, NSError *error, NSString *redirectedServer)) failureRequest {
     
     serverPath = [serverPath stringByAppendingString:k_url_create_link_mobile_editor];
-    serverPath = [NSString stringWithFormat:@"%@/%@", serverPath, fileID];
-    serverPath = [serverPath stringByAppendingString:@"?format=json"];
-    //serverPath = [NSString stringWithFormat:@"%@?fileid=%@", serverPath, fileID];
-    //serverPath = [serverPath stringByAppendingString:@"&format=json"];
+    //serverPath = [NSString stringWithFormat:@"%@/%@", serverPath, fileID];
+    //serverPath = [serverPath stringByAppendingString:@"?format=json"];
+    serverPath = [NSString stringWithFormat:@"%@?fileid=%@", serverPath, fileID];
+    serverPath = [serverPath stringByAppendingString:@"&format=json"];
     
     OCWebDAVClient *request = [[OCWebDAVClient alloc] init];
     request = [self getRequestWithCredentials:request];

+ 3 - 1
iOSClient/Networking/OCNetworking.m

@@ -2202,7 +2202,9 @@
     [communication setCredentialsWithUser:_activeUser andUserID:_activeUserID andPassword:_activePassword];
     [communication setUserAgent:[CCUtility getUserAgent]];
     
-    [communication createLinkRichdocuments:[_activeUrl stringByAppendingString:@"/"] fileID:fileID onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
+    NSString *fileIDServer = [[NCUtility sharedInstance] convertFileIDClientToFileIDServer:fileID];
+    
+    [communication createLinkRichdocuments:[_activeUrl stringByAppendingString:@"/"] fileID:fileIDServer onCommunication:communication successRequest:^(NSHTTPURLResponse *response, NSString *redirectedServer) {
         
         success(@"");
         

+ 11 - 0
iOSClient/Utility/NCUtility.swift

@@ -105,4 +105,15 @@ class NCUtility: NSObject {
         
         return screenWidth
     }
+    
+    @objc func convertFileIDClientToFileIDServer(_ fileID: NSString) -> String {
+        
+        let split = fileID.components(separatedBy: "oc")
+        if split.count == 2 {
+            let fileIDServerInt = CLongLong(split[0])
+            return String(describing: fileIDServerInt ?? 0)
+        }
+        
+        return fileID as String
+    }
 }