Fix gathering content providers by search
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / CmsContentSession.java
index 290552f640b2235fdc32fa8c906d968b1ae2d9a6..832054e03bacaf1a1ec848523b87e66586922a9f 100644 (file)
@@ -206,18 +206,21 @@ class CmsContentSession implements ProvidedSession, UuidIdentified {
                        NavigableMap<String, ContentProvider> contentProviders = contentRepository.getMountManager()
                                        .findContentProviders(scopePath);
                        for (Map.Entry<String, ContentProvider> contentProvider : contentProviders.entrySet()) {
+                               assert scopePath.startsWith(contentProvider.getKey())
+                                               : "scopePath=" + scopePath + ", contentProvider path=" + contentProvider.getKey();
                                // TODO deal with depth
                                String relPath;
-                               if (scopePath.startsWith(contentProvider.getKey())) {
-                                       relPath = scopePath.substring(contentProvider.getKey().length());
-                               } else {
-                                       relPath = null;
-                               }
+//                             if (scopePath.startsWith(contentProvider.getKey())) {
+                               relPath = scopePath.substring(contentProvider.getKey().length() + 1, scopePath.length());
+//                             }
+//                             else {
+//                                     relPath = null;
+//                             }
                                SearchPartition searchPartition = new SearchPartition(s, relPath, contentProvider.getValue());
                                searchPartitions.put(contentProvider.getKey(), searchPartition);
                        }
                }
-               if(searchPartitions.isEmpty())
+               if (searchPartitions.isEmpty())
                        return Stream.empty();
                return StreamSupport.stream(new SearchPartitionsSpliterator(searchPartitions), true);
        }