Fix when search scope path is the partition path
[lgpl/argeo-commons.git] / org.argeo.cms / src / org / argeo / cms / acr / CmsContentSession.java
index 832054e03bacaf1a1ec848523b87e66586922a9f..c782256e282acb94b97a7233ce0ddb4ad9d2cf0c 100644 (file)
@@ -210,12 +210,11 @@ class CmsContentSession implements ProvidedSession, UuidIdentified {
                                                : "scopePath=" + scopePath + ", contentProvider path=" + contentProvider.getKey();
                                // TODO deal with depth
                                String relPath;
-//                             if (scopePath.startsWith(contentProvider.getKey())) {
-                               relPath = scopePath.substring(contentProvider.getKey().length() + 1, scopePath.length());
-//                             }
-//                             else {
-//                                     relPath = null;
-//                             }
+                               if (!scopePath.equals(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);
                        }