[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] fix for unescaped etag in mod dav checkout.

From: Clark Rawlins <clark_at_bit63.org>
Date: 2002-09-27 15:37:21 CEST

This small patch fixes a problem where etags sometimes can contain
unescaped & characters.

To reproduce:
svnadmin create test
{configure apache to use test as a repos}
svn co http://localhost/svn/test
cd test
touch test\&test
svn add test\&test
svn commit -m "Add file with an ampersand in the name."
cd ..
rm -rf test
svn co http://localhost/svn/test
XML parse error here!

This five line patch fixes the problem.

Index: repos.c
===================================================================
--- repos.c
+++ repos.c 2002-09-26 22:27:44.000000000 -0500
@@ -1597,6 +1597,7 @@
 {
   svn_error_t *serr;
   svn_revnum_t created_rev;
+ const char *quoted_path;
 
   /* if the resource doesn't exist, isn't a simple REGULAR or VERSION
      resource, or it is a Baseline, then it has no etag. */
@@ -1616,9 +1617,12 @@
       /* ### what to do? */
       return "";
     }
+
+ quoted_path = apr_xml_quote_string(resource->pool,
+ resource->info->repos_path, 1);
   
   return apr_psprintf(resource->pool, "\"%" SVN_REVNUM_T_FMT "/%s\"",
- created_rev, resource->info->repos_path);
+ created_rev, quoted_path);
 }
 
 static dav_error * dav_svn_set_headers(request_rec *r,

-- 
"They that can give up essential liberty to obtain a little temporary safety
  deserve neither liberty nor safety."
  - Benjamin Franklin, Historical Review of Pennsylvania, 1759. 

  • application/pgp-signature attachment: stored
Received on Fri Sep 27 15:38:12 2002

This is an archived mail posted to the Subversion Dev mailing list.