Author: cmpilato
Date: Fri Oct 12 13:48:50 2012
New Revision: 1397563

URL: http://svn.apache.org/viewvc?rev=1397563&view=rev
Log:
On the 'http-dynamic-prop-namespaces' branch: fix the way we build out
the extended property namespace URIs to avoid assertions.

* subversion/mod_dav_svn/deadprops.c
  (propname_to_davname): Use apr_pstrcat() and svn_path_uri_encode()
    rather than svn_path_url_add_component2() because the namespace
    base URI isn't canonical (it has a trailing slash) and we don't
    need (or really want) to run this thing through canonicalization
    routines -- to us, it's just a string with a known, fixed prefix.
  (davname_to_propname): Use svn_path_url_decode on a string splice
    (of sorts) rather than invoking the very picky svn_uri_* APIs.

* subversion/libsvn_ra_serf/property.c
  (svn_ra_serf__wirename_from_svnname, svn_ra_serf__svnname_from_wirename):
    Do the same things here.

Modified:
    
subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/property.c
    
subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/deadprops.c

Modified: 
subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/property.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/property.c?rev=1397563&r1=1397562&r2=1397563&view=diff
==============================================================================
--- 
subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/property.c
 (original)
+++ 
subversion/branches/http-dynamic-prop-namespaces/subversion/libsvn_ra_serf/property.c
 Fri Oct 12 13:48:50 2012
@@ -864,11 +864,11 @@ svn_ra_serf__wirename_from_svnname(const
           /* ...but anything else requires the extensible namespace. */
           else
             {
-              *ns = svn_path_url_add_component2(SVN_DAV_PROP_NS_EXTENSIBLE,
-                                                apr_pstrndup(result_pool,
-                                                             svnname,
-                                                             colon - svnname),
-                                                result_pool);
+              const char *barename = apr_pstrndup(result_pool, svnname,
+                                                  colon - svnname);
+              *ns = apr_pstrcat(result_pool, SVN_DAV_PROP_NS_EXTENSIBLE,
+                                svn_path_uri_encode(barename, result_pool),
+                                (char *)NULL);
             }
 
           /* Either way, the base name begins after the colon. */
@@ -905,8 +905,9 @@ svn_ra_serf__svnname_from_wirename(const
   if (strncmp(ns, SVN_DAV_PROP_NS_EXTENSIBLE,
               sizeof(SVN_DAV_PROP_NS_EXTENSIBLE) - 1) == 0)
     {
-      const char *relpath = svn_uri_skip_ancestor(SVN_DAV_PROP_NS_EXTENSIBLE,
-                                                  ns, result_pool);
+      const char *relpath =
+        svn_path_uri_decode(ns + (sizeof(SVN_DAV_PROP_NS_EXTENSIBLE) - 1),
+                            result_pool);
       return apr_pstrcat(result_pool, relpath, ":", name, (char *)NULL);
     }
 

Modified: 
subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/deadprops.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/deadprops.c?rev=1397563&r1=1397562&r2=1397563&view=diff
==============================================================================
--- 
subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/deadprops.c
 (original)
+++ 
subversion/branches/http-dynamic-prop-namespaces/subversion/mod_dav_svn/deadprops.c
 Fri Oct 12 13:48:50 2012
@@ -107,15 +107,13 @@ davname_to_propname(dav_db *db,
                    sizeof(SVN_DAV_PROP_NS_EXTENSIBLE) - 1) == 0)
     {
       const char *relpath =
-        svn_uri_skip_ancestor(SVN_DAV_PROP_NS_EXTENSIBLE,
-                              davname->ns, db->resource->pool);
-      if (relpath)
-        {
-          svn_stringbuf_set(db->work, relpath);
-          svn_stringbuf_appendbytes(db->work, ":", 1);
-          svn_stringbuf_appendcstr(db->work, davname->name);
-          propname = db->work->data;
-        }
+        svn_path_uri_decode(davname->ns +
+                            (sizeof(SVN_DAV_PROP_NS_EXTENSIBLE) - 1),
+                            db->resource->pool);
+      svn_stringbuf_set(db->work, relpath);
+      svn_stringbuf_appendbytes(db->work, ":", 1);
+      svn_stringbuf_appendcstr(db->work, davname->name);
+      propname = db->work->data;
     }
 
   return propname;
@@ -169,11 +167,11 @@ propname_to_davname(svn_boolean_t *needs
          the magic prefixes we've already built in. */
       else
         {
+          const char *barename = apr_pstrndup(pool, propname, colon - 
propname);
           *needs_ext_ns = TRUE;
-          davname->ns = svn_path_url_add_component2(
-                            SVN_DAV_PROP_NS_EXTENSIBLE,
-                            apr_pstrndup(pool, propname, colon - propname),
-                            pool);
+          davname->ns = apr_pstrcat(pool, SVN_DAV_PROP_NS_EXTENSIBLE,
+                                    svn_path_uri_encode(barename, pool),
+                                    (char *)NULL);
           davname->name = apr_pstrdup(pool, colon + 1);
         }
     }


Reply via email to