gvfs r1805 - in trunk: . daemon
- From: awalton svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1805 - in trunk: . daemon
- Date: Wed, 11 Jun 2008 15:13:24 +0000 (UTC)
Author: awalton
Date: Wed Jun 11 15:13:24 2008
New Revision: 1805
URL: http://svn.gnome.org/viewvc/gvfs?rev=1805&view=rev
Log:
2008-06-11 A. Walton <awalton gnome org>
* daemon/gvfsbackendtrash.c (escape_pathname),
(unescape_pathname):
Use hex escapes in the trash backend.
Patch by Andreas Henriksson.
Fixes bug #523139.
Modified:
trunk/ChangeLog
trunk/daemon/gvfsbackendtrash.c
Modified: trunk/daemon/gvfsbackendtrash.c
==============================================================================
--- trunk/daemon/gvfsbackendtrash.c (original)
+++ trunk/daemon/gvfsbackendtrash.c Wed Jun 11 15:13:24 2008
@@ -147,17 +147,21 @@
while (*dir == '/')
dir++;
- /* Underscores are doubled, count them */
+ /* count characters that need to be escaped. */
count = 0;
p = dir;
while (*p)
{
if (*p == '_')
count++;
+ if (*p == '/')
+ count++;
+ if (*p == '%')
+ count++;
p++;
}
- res = g_malloc (strlen (dir) + count + 1);
+ res = g_malloc (strlen (dir) + count*2 + 1);
p = dir;
d = res;
@@ -166,18 +170,27 @@
c = *p++;
if (c == '_')
{
- *d++ = '_';
- *d++ = '_';
+ *d++ = '%';
+ *d++ = '5';
+ *d++ = 'f';
}
else if (c == '/')
{
- *d++ = '_';
+ *d++ = '%';
+ *d++ = '2';
+ *d++ = 'f';
/* Skip consecutive slashes, they are unnecessary,
and break our escaping */
while (*p == '/')
p++;
}
+ else if (c == '%')
+ {
+ *d++ = '%';
+ *d++ = '2';
+ *d++ = '5';
+ }
else
*d++ = c;
}
@@ -215,20 +228,22 @@
while (p < end)
{
c = *p++;
- if (c == '_')
+ if (c == '%' && p < (end-1))
{
- if (p == end)
- *d++ = '_';
- else
+ if (*(p) == '2' && *(p+1) == 'f')
{
- c = *p;
- if (c == '_')
- {
- p++;
- *d++ = '_';
- }
- else
- *d++ = '/';
+ *d++ = '/';
+ p+=2;
+ }
+ else if (*(p) == '2' && *(p+1) == '5')
+ {
+ *d++ = '%';
+ p+=2;
+ }
+ else if (*(p) == '5' && *(p+1) == 'f')
+ {
+ *d++ = '_';
+ p+=2;
}
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]