manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1843037 - in /manifoldcf/trunk: CHANGES.txt connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Date Sat, 06 Oct 2018 23:56:03 GMT
Author: kwright
Date: Sat Oct  6 23:56:03 2018
New Revision: 1843037

URL: http://svn.apache.org/viewvc?rev=1843037&view=rev
Log:
Fix for CONNECTORS-1543.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1843037&r1=1843036&r2=1843037&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Sat Oct  6 23:56:03 2018
@@ -3,6 +3,9 @@ $Id$
 
 ======================= 2.12-dev =====================
 
+CONNECTORS-1543: Map illegal file name characters to '_'.
+(Douglas C. R. Paes)
+
 CONNECTORS-1537: Numerous changes to GoogleDrive connector to support paths etc.
 (Douglas C. R. Paes)
 

Modified: manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java?rev=1843037&r1=1843036&r2=1843037&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
(original)
+++ manifoldcf/trunk/connectors/googledrive/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/googledrive/GoogleDriveRepositoryConnector.java
Sat Oct  6 23:56:03 2018
@@ -1119,7 +1119,7 @@ public class GoogleDriveRepositoryConnec
               DateTime createdDateObject = googleFile.getCreatedDate();
               DateTime modifiedDateObject = googleFile.getModifiedDate();
               String extension = googleFile.getFileExtension();
-              String title = googleFile.getTitle();
+              String title = cleanupFileFolderName(googleFile.getTitle());
               Date createdDate = (createdDateObject==null)?null:new Date(createdDateObject.getValue());
               Date modifiedDate = (modifiedDateObject==null)?null:new Date(modifiedDateObject.getValue());
               // We always direct to the PDF except for Spreadsheets
@@ -1343,7 +1343,7 @@ public class GoogleDriveRepositoryConnec
 
           String path = getFilePath(parent);
           String name;
-          String title = googleFile.getTitle();
+          String title = cleanupFileFolderName(googleFile.getTitle());
 
           String extension = googleFile.getFileExtension();
 
@@ -1366,7 +1366,7 @@ public class GoogleDriveRepositoryConnec
         }
       } else {
         String path = getFilePath(googleFile);
-        String name = googleFile.getTitle();
+        String name = cleanupFileFolderName(googleFile.getTitle());
         fullContentPath = path + SLASH + name;
       }
     } catch (ManifoldCFException e) {
@@ -1396,7 +1396,7 @@ public class GoogleDriveRepositoryConnec
       folderPath += "/" + folder;
     }
 
-    fullFilePath = folderPath + "/" + file.getTitle();
+    fullFilePath = folderPath + "/" + cleanupFileFolderName(file.getTitle());
 
     return fullFilePath;
   }
@@ -1407,7 +1407,7 @@ public class GoogleDriveRepositoryConnec
       String id = parentReferencesList.get(i).getId();
 
       File file = getObject(id);
-      folderList.add(file.getTitle());
+      folderList.add(cleanupFileFolderName(file.getTitle()));
 
       if (!(file.getParents().isEmpty())) {
         List<ParentReference> parentReferenceslist2 = file.getParents();
@@ -1565,4 +1565,10 @@ public class GoogleDriveRepositoryConnec
     // Permanent problem: can't initialize transport layer
     throw new ManifoldCFException("GoogleDrive exception: "+e.getMessage(), e);
   }
-}
+  
+  private String cleanupFileFolderName(String name) {
+	  name = name.trim();
+	  name = name.replaceAll("[\\\\/:*?\"<>|]", "_");
+	  return name;
+  }
+}
\ No newline at end of file



Mime
View raw message