diff --git a/scm-plugins/scm-svn-plugin/pom.xml b/scm-plugins/scm-svn-plugin/pom.xml
index 7b74b2b464..6e646b9004 100644
--- a/scm-plugins/scm-svn-plugin/pom.xml
+++ b/scm-plugins/scm-svn-plugin/pom.xml
@@ -53,7 +53,7 @@
- 1.3.5.7
+ 1.3.5.8-SNAPSHOT
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java
index cbd9254238..536586f95a 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHandler.java
@@ -102,7 +102,7 @@ public class SvnRepositoryHandler
// register hook
if (repositoryManager != null)
{
- FSHooks.registerHook(new SvnRepositoryHook(repositoryManager));
+ FSHooks.registerHook(new SvnRepositoryHook(repositoryManager, this));
}
else if (logger.isWarnEnabled())
{
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHook.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHook.java
index bceacf5bbd..e8b9e63e4a 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHook.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/repository/SvnRepositoryHook.java
@@ -46,6 +46,7 @@ import org.tmatesoft.svn.core.internal.io.fs.FSHook;
import org.tmatesoft.svn.core.internal.io.fs.FSHookEvent;
import org.tmatesoft.svn.core.internal.io.fs.FSHooks;
+import sonia.scm.util.IOUtil;
import sonia.scm.util.Util;
//~--- JDK imports ------------------------------------------------------------
@@ -70,10 +71,13 @@ public class SvnRepositoryHook implements FSHook
*
*
* @param repositoryManager
+ * @param handler
*/
- public SvnRepositoryHook(RepositoryManager repositoryManager)
+ public SvnRepositoryHook(RepositoryManager repositoryManager,
+ SvnRepositoryHandler handler)
{
this.repositoryManager = repositoryManager;
+ this.handler = handler;
}
//~--- methods --------------------------------------------------------------
@@ -151,8 +155,14 @@ public class SvnRepositoryHook implements FSHook
{
try
{
- repositoryManager.fireHookEvent(SvnRepositoryHandler.TYPE_NAME,
- directory.getName(), hookEvent);
+ String name =
+ directory.getAbsolutePath()
+ .substring(handler.getConfig().getRepositoryDirectory()
+ .getAbsolutePath().length());
+
+ name = IOUtil.trimSeperatorChars(name);
+ repositoryManager.fireHookEvent(SvnRepositoryHandler.TYPE_NAME, name,
+ hookEvent);
}
catch (Exception ex)
{
@@ -168,6 +178,9 @@ public class SvnRepositoryHook implements FSHook
//~--- fields ---------------------------------------------------------------
+ /** Field description */
+ private SvnRepositoryHandler handler;
+
/** Field description */
private RepositoryManager repositoryManager;
}
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java
index 0a39e80561..6145f79609 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVConfig.java
@@ -35,10 +35,17 @@ package sonia.scm.web;
//~--- non-JDK imports --------------------------------------------------------
+import com.google.inject.Provider;
+
import org.tmatesoft.svn.core.internal.server.dav.DAVConfig;
import org.tmatesoft.svn.core.internal.server.dav.SVNPathBasedAccess;
-import sonia.scm.repository.SvnConfig;
+import sonia.scm.repository.Repository;
+import sonia.scm.repository.SvnRepositoryHandler;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.File;
/**
*
@@ -52,12 +59,15 @@ public class SvnDAVConfig extends DAVConfig
*
*
* @param davConfig
- * @param config
+ * @param handler
+ * @param repositoryProvider
*/
- public SvnDAVConfig(DAVConfig davConfig, SvnConfig config)
+ public SvnDAVConfig(DAVConfig davConfig, SvnRepositoryHandler handler,
+ Provider repositoryProvider)
{
this.davConfig = davConfig;
- this.config = config;
+ this.handler = handler;
+ this.repositoryProvider = repositoryProvider;
}
//~--- get methods ----------------------------------------------------------
@@ -71,7 +81,7 @@ public class SvnDAVConfig extends DAVConfig
@Override
public String getActivitiesDBPath()
{
- return davConfig.getActivitiesDBPath();
+ return null;
}
/**
@@ -95,7 +105,19 @@ public class SvnDAVConfig extends DAVConfig
@Override
public String getRepositoryParentPath()
{
- return config.getRepositoryDirectory().getAbsolutePath();
+ String path = null;
+ File directory = getRepositoryDirectory();
+
+ if (directory != null)
+ {
+ path = directory.getParent();
+ }
+ else
+ {
+ path = davConfig.getRepositoryPath();
+ }
+
+ return path;
}
/**
@@ -107,7 +129,19 @@ public class SvnDAVConfig extends DAVConfig
@Override
public String getRepositoryPath()
{
- return davConfig.getRepositoryPath();
+ String path = null;
+ File directory = getRepositoryDirectory();
+
+ if (directory != null)
+ {
+ path = directory.getAbsolutePath();
+ }
+ else
+ {
+ path = davConfig.getRepositoryPath();
+ }
+
+ return path;
}
/**
@@ -227,14 +261,36 @@ public class SvnDAVConfig extends DAVConfig
@Override
public boolean isUsingRepositoryPathDirective()
{
- return davConfig.isUsingRepositoryPathDirective();
+ return true;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ private File getRepositoryDirectory()
+ {
+ File directory = null;
+ Repository repository = repositoryProvider.get();
+
+ if (repository != null)
+ {
+ directory = handler.getDirectory(repository);
+ }
+
+ return directory;
}
//~--- fields ---------------------------------------------------------------
/** Field description */
- private SvnConfig config;
+ private DAVConfig davConfig;
/** Field description */
- private DAVConfig davConfig;
+ private SvnRepositoryHandler handler;
+
+ /** Field description */
+ private Provider repositoryProvider;
}
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java
index c5e5f6c6ab..7e7723aa60 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnDAVServlet.java
@@ -36,12 +36,26 @@ package sonia.scm.web;
//~--- non-JDK imports --------------------------------------------------------
import com.google.inject.Inject;
+import com.google.inject.Provider;
import com.google.inject.Singleton;
import org.tmatesoft.svn.core.internal.server.dav.DAVConfig;
import org.tmatesoft.svn.core.internal.server.dav.DAVServlet;
+import sonia.scm.repository.Repository;
import sonia.scm.repository.SvnRepositoryHandler;
+import sonia.scm.util.AssertUtil;
+import sonia.scm.util.HttpUtil;
+import sonia.scm.util.IOUtil;
+
+//~--- JDK imports ------------------------------------------------------------
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletRequestWrapper;
+import javax.servlet.http.HttpServletResponse;
/**
*
@@ -61,11 +75,34 @@ public class SvnDAVServlet extends DAVServlet
*
*
* @param handler
+ * @param repositoryProvider
*/
@Inject
- public SvnDAVServlet(SvnRepositoryHandler handler)
+ public SvnDAVServlet(SvnRepositoryHandler handler,
+ Provider repositoryProvider)
{
this.handler = handler;
+ this.repositoryProvider = repositoryProvider;
+ }
+
+ //~--- methods --------------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @param request
+ * @param response
+ *
+ * @throws IOException
+ * @throws ServletException
+ */
+ @Override
+ public void service(HttpServletRequest request, HttpServletResponse response)
+ throws ServletException, IOException
+ {
+ super.service(new SvnHttpServletRequestWrapper(request,
+ repositoryProvider), response);
}
//~--- get methods ----------------------------------------------------------
@@ -79,11 +116,103 @@ public class SvnDAVServlet extends DAVServlet
@Override
protected DAVConfig getDAVConfig()
{
- return new SvnDAVConfig(super.getDAVConfig(), handler.getConfig());
+ return new SvnDAVConfig(super.getDAVConfig(), handler, repositoryProvider);
}
+ //~--- inner classes --------------------------------------------------------
+
+ /**
+ * Class description
+ *
+ *
+ * @version Enter version here..., 11/10/23
+ * @author Enter your name here...
+ */
+ private static class SvnHttpServletRequestWrapper
+ extends HttpServletRequestWrapper
+ {
+
+ /**
+ * Constructs ...
+ *
+ *
+ * @param request
+ * @param repositoryProvider
+ */
+ public SvnHttpServletRequestWrapper(HttpServletRequest request,
+ Provider repositoryProvider)
+ {
+ super(request);
+ this.repositoryProvider = repositoryProvider;
+ }
+
+ //~--- get methods --------------------------------------------------------
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public String getPathInfo()
+ {
+ String pathInfo = super.getPathInfo();
+
+ AssertUtil.assertIsNotEmpty(pathInfo);
+
+ Repository repository = repositoryProvider.get();
+
+ if (repository != null)
+ {
+ if (pathInfo.startsWith(HttpUtil.SEPARATOR_PATH))
+ {
+ pathInfo = pathInfo.substring(1);
+ }
+
+ pathInfo = pathInfo.substring(repository.getName().length());
+ }
+
+ return pathInfo;
+ }
+
+ /**
+ * Method description
+ *
+ *
+ * @return
+ */
+ @Override
+ public String getServletPath()
+ {
+ String servletPath = super.getServletPath();
+ Repository repository = repositoryProvider.get();
+
+ if (repository != null)
+ {
+ if (!servletPath.endsWith(HttpUtil.SEPARATOR_PATH))
+ {
+ servletPath = servletPath.concat(HttpUtil.SEPARATOR_PATH);
+ }
+
+ servletPath = servletPath.concat(repository.getName());
+ }
+
+ return servletPath;
+ }
+
+ //~--- fields -------------------------------------------------------------
+
+ /** Field description */
+ private Provider repositoryProvider;
+ }
+
+
//~--- fields ---------------------------------------------------------------
/** Field description */
private SvnRepositoryHandler handler;
+
+ /** Field description */
+ private Provider repositoryProvider;
}
diff --git a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java
index 9c7d582bd9..24e556f274 100644
--- a/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java
+++ b/scm-plugins/scm-svn-plugin/src/main/java/sonia/scm/web/SvnPermissionFilter.java
@@ -39,9 +39,8 @@ import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
-import sonia.scm.repository.RepositoryManager;
-import sonia.scm.repository.SvnRepositoryHandler;
-import sonia.scm.web.filter.RegexPermissionFilter;
+import sonia.scm.repository.Repository;
+import sonia.scm.web.filter.ProviderPermissionFilter;
import sonia.scm.web.security.WebSecurityContext;
//~--- JDK imports ------------------------------------------------------------
@@ -57,7 +56,7 @@ import javax.servlet.http.HttpServletRequest;
* @author Sebastian Sdorra
*/
@Singleton
-public class SvnPermissionFilter extends RegexPermissionFilter
+public class SvnPermissionFilter extends ProviderPermissionFilter
{
/** Field description */
@@ -74,30 +73,18 @@ public class SvnPermissionFilter extends RegexPermissionFilter
*
*
* @param securityContextProvider
- * @param repositoryManager
+ * @param repository
*/
@Inject
public SvnPermissionFilter(
Provider securityContextProvider,
- RepositoryManager repositoryManager)
+ Provider repository)
{
- super(securityContextProvider, repositoryManager);
+ super(securityContextProvider, repository);
}
//~--- get methods ----------------------------------------------------------
- /**
- * Method description
- *
- *
- * @return
- */
- @Override
- protected String getType()
- {
- return SvnRepositoryHandler.TYPE_NAME;
- }
-
/**
* Method description
*
diff --git a/scm-webapp/pom.xml b/scm-webapp/pom.xml
index 1b053644ab..84427e2955 100644
--- a/scm-webapp/pom.xml
+++ b/scm-webapp/pom.xml
@@ -356,7 +356,7 @@
1.13
1.0
3.0.3
- gfv3ee6
+ Tomcat