Author: svn-role
Date: Thu Dec  6 04:02:28 2012
New Revision: 1417733

URL: http://svn.apache.org/viewvc?rev=1417733&view=rev
Log:
Merge r1409146 from trunk:

 * r1409146
   Make sure svn_uri_get_file_url_from_dirent() returns a canonical url for
   Windows drive roots.
   Justification:
     Handles a Windows specific corner case in a generic conversion function.
   Votes:
     +1: rhuijben, stefan2, pburba
>>>>>>> .r1417732

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c
    subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1409146

Modified: subversion/branches/1.7.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1417733&r1=1417732&r2=1417733&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Thu Dec  6 04:02:28 2012
@@ -102,11 +102,3 @@ Approved changes:
      revision.
    Votes:
      +1: cmpilato, rhuijben, brane
-
- * r1409146
-   Make sure svn_uri_get_file_url_from_dirent() returns a canonical url for
-   Windows drive roots.
-   Justification:
-     Handles a Windows specific corner case in a generic conversion function.
-   Votes:
-     +1: rhuijben, stefan2, pburba

Modified: subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c?rev=1417733&r1=1417732&r2=1417733&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_subr/dirent_uri.c Thu Dec  6 
04:02:28 2012
@@ -2443,7 +2443,17 @@ svn_uri_get_file_url_from_dirent(const c
       *url = apr_pstrcat(pool, "file:", dirent, NULL);
     }
   else
-    *url = apr_pstrcat(pool, "file:///", dirent, NULL);
+    {
+      char *uri = apr_pstrcat(pool, "file:///", dirent, NULL);
+      apr_size_t len = 8 /* strlen("file:///") */ + strlen(dirent);
+
+      /* "C:/" is a canonical dirent on Windows,
+         but "file:///C:/" is not a canonical uri */
+      if (uri[len-1] == '/')
+        uri[len-1] = '\0';
+
+      *url = uri;
+    }
 #endif
 
   return SVN_NO_ERROR;

Modified: 
subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c?rev=1417733&r1=1417732&r2=1417733&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c 
(original)
+++ subversion/branches/1.7.x/subversion/tests/libsvn_subr/dirent_uri-test.c 
Thu Dec  6 04:02:28 2012
@@ -2492,7 +2492,7 @@ test_file_url_from_dirent(apr_pool_t *po
   } tests[] = {
 #ifdef SVN_USE_DOS_PATHS
     { "C:/file",                   "file:///C:/file" },
-    { "C:/",                       "file:///C:/" },
+    { "C:/",                       "file:///C:" },
     { "C:/File#$",                 "file:///C:/File%23$" },
     /* We can't check these as svn_dirent_get_absolute() won't work
        on shares that don't exist */
@@ -2519,6 +2519,8 @@ test_file_url_from_dirent(apr_pool_t *po
                                  "svn_uri_get_file_url_from_dirent(\"%s\") "
                                  "returned \"%s\" expected \"%s\"",
                                  tests[i].dirent, result, tests[i].result);
+
+      SVN_TEST_ASSERT(svn_uri_is_canonical(result, pool));
     }
 
   return SVN_NO_ERROR;


Reply via email to