marinofaggiana 4 年之前
父節點
當前提交
eff5e220da
共有 1 個文件被更改,包括 21 次插入9 次删除
  1. 21 9
      iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

+ 21 - 9
iOSClient/Main/Colleaction Common/NCCollectionCommon.swift

@@ -431,6 +431,16 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
         
         var listData: [String] = []
         
+        // Detect metadataKeyedUnarchiver
+        var foundMetadataKeyedUnarchiver: Bool = false
+        for item in UIPasteboard.general.items {
+            for object in item {
+                if object.key == NCBrandGlobal.shared.metadataKeyedUnarchiver {
+                    foundMetadataKeyedUnarchiver = true
+                }
+            }
+        }
+        
         for item in UIPasteboard.general.items {
             for object in item {
                 let contentType = object.key
@@ -445,16 +455,18 @@ class NCCollectionCommon: NSObject, NCSelectDelegate {
                     }
                     continue
                 }
-                if data is String {
-                    if listData.contains(data as! String) {
-                        continue
-                    } else {
-                        listData.append(data as! String)
+                if !foundMetadataKeyedUnarchiver {
+                    if data is String {
+                        if listData.contains(data as! String) {
+                            continue
+                        } else {
+                            listData.append(data as! String)
+                        }
+                    }
+                    let type = NCCommunicationCommon.shared.convertUTItoResultType(fileUTI: contentType as CFString)
+                    if type.resultTypeFile != NCCommunicationCommon.typeFile.unknow.rawValue && type.resultExtension != "" {
+                        uploadPasteFile(fileName: type.resultFilename, ext: type.resultExtension, contentType: contentType, serverUrl: serverUrl, data: data)
                     }
-                }
-                let type = NCCommunicationCommon.shared.convertUTItoResultType(fileUTI: contentType as CFString)
-                if type.resultTypeFile != NCCommunicationCommon.typeFile.unknow.rawValue && type.resultExtension != "" {
-                    uploadPasteFile(fileName: type.resultFilename, ext: type.resultExtension, contentType: contentType, serverUrl: serverUrl, data: data)
                 }
             }
         }