You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/07/16 02:33:33 UTC

svn commit: r1503528 - /subversion/trunk/subversion/mod_dav_svn/repos.c

Author: breser
Date: Tue Jul 16 00:33:32 2013
New Revision: 1503528

URL: http://svn.apache.org/r1503528
Log:
mod_dav_svn: Use our canonicalize function and canonicalize in the right spot.

Our higher level code shouldn't be figuring out how to canonicalize paths,
that's what we have the canonicalize functions for.  We should always use
them.  Also we don't need to canonicalize paths produced by our own APIs
unless we know they aren't canonical.

* subversion/mod_dav_svn/repos.c
  (get_parent_resource): canonicalize here and only paths from mod_dav.
  (get_parent_path): Remove custom canonicalize code.

Modified:
    subversion/trunk/subversion/mod_dav_svn/repos.c

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1503528&r1=1503527&r2=1503528&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Tue Jul 16 00:33:32 2013
@@ -2408,21 +2408,12 @@ get_parent_path(const char *path,
                 svn_boolean_t is_urlpath,
                 apr_pool_t *pool)
 {
-  apr_size_t len;
-  char *tmp = apr_pstrdup(pool, path);
-
-  len = strlen(tmp);
-
-  if (len > 0)
+  if (*path != '\0') /* not an empty string */
     {
-      /* Remove any trailing slash; else svn_path_dirname() asserts. */
-      if (tmp[len-1] == '/')
-        tmp[len-1] = '\0';
-
       if (is_urlpath)
-        return svn_urlpath__dirname(tmp, pool);
+        return svn_urlpath__dirname(path, pool);
       else
-        return svn_fspath__dirname(tmp, pool);
+        return svn_fspath__dirname(path, pool);
     }
 
   return path;
@@ -2458,7 +2449,9 @@ get_parent_resource(const dav_resource *
       parent->versioned = 1;
       parent->hooks = resource->hooks;
       parent->pool = resource->pool;
-      parent->uri = get_parent_path(resource->uri, TRUE, resource->pool);
+      parent->uri = get_parent_path(svn_urlpath__canonicalize(resource->uri,
+                                                              resource->pool),
+                                    TRUE, resource->pool);
       parent->info = parentinfo;
 
       parentinfo->uri_path =