From 361f3af513627e91ca8f134e25c71ab52c58eb9f Mon Sep 17 00:00:00 2001 From: Oliver Kelling Date: Sun, 16 Feb 2020 13:13:08 +0100 Subject: [PATCH] Fixed regular expressions to be able to handle prefixed pathes. The regular expressions now can handle pathes like: /something/item/... /item/... /another/user/... /user /any/prefix/path/collection/.. --- .../org/unitedinternet/cosmo/server/CollectionPath.java | 8 ++++---- .../java/org/unitedinternet/cosmo/server/ItemPath.java | 8 ++++---- .../java/org/unitedinternet/cosmo/server/UserPath.java | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/CollectionPath.java b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/CollectionPath.java index 4ba5ba53..1e72c4e6 100755 --- a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/CollectionPath.java +++ b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/CollectionPath.java @@ -1,12 +1,12 @@ /* * Copyright 2006 Open Source Applications Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ public class CollectionPath { private static final Log LOG = LogFactory.getLog(CollectionPath.class); private static final Pattern PATTERN_COLLECTION_UID = - Pattern.compile("^/collection/([^/]+)(/.*)?$"); + Pattern.compile("^.*/collection/([^/]+)(/.*)?$"); private String urlPath; private String uid; diff --git a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/ItemPath.java b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/ItemPath.java index 7bf33fb7..c6521529 100755 --- a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/ItemPath.java +++ b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/ItemPath.java @@ -1,12 +1,12 @@ /* * Copyright 2006 Open Source Applications Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ public class ItemPath { private static final Log LOG = LogFactory.getLog(ItemPath.class); private static final Pattern PATTERN_ITEM_UID = - Pattern.compile("^/(item|expanded|detached)/([^/]+)(/.*)?$"); + Pattern.compile("^.*/(item|expanded|detached)/([^/]+)(/.*)?$"); private String urlPath; private String uid; diff --git a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/UserPath.java b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/UserPath.java index 12d1a712..803d898d 100755 --- a/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/UserPath.java +++ b/cosmo-core/src/main/java/org/unitedinternet/cosmo/server/UserPath.java @@ -1,12 +1,12 @@ /* * Copyright 2006 Open Source Applications Foundation - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -40,7 +40,7 @@ public class UserPath { private static final Log LOG = LogFactory.getLog(UserPath.class); private static final Pattern PATTERN_USER_USERNAME = - Pattern.compile("^/user/([^/]+)(/.*)?$"); + Pattern.compile("^.*/user/([^/]+)(/.*)?$"); private String urlPath; private String username;