[pkg-php-pear] Bug#791363: [PATCH] php-http-webdav-server: WebDAV encoding problems

Jan-Benedict Glaw jbglaw at lug-owl.de
Fri Jul 3 20:33:34 UTC 2015


Package: php-http-webdav-server
Version: 1.0.0RC6-2

Hi packet maintainer(s), hi Hartmut!

I'm currently setting up a document management system (based on
SeedDMS) and had servere issues with contents containing German
Umlauts or any other non-US-ASCII glyphs in their names.

  Seems there were rumors and even actual bug reports regarding
encoding issues. As it turns out, it *seems* to be quite a simple bug
where something like rawurlencode() should have been used, but without
actually encoding the '/' characters in between.

  I propose this patch, which seems to solve all my problems with the
DMS. It might need testing with other WebDAV implementations using
PHP's backend, but I don't know of any.

  Here's my patch fixing the issue for me:


--- /usr/share/php/HTTP/WebDAV/Server.php~orig	2015-07-03 21:59:34.115349471 +0200
+++ /usr/share/php/HTTP/WebDAV/Server.php	2015-07-03 22:02:52.292439548 +0200
@@ -2059,12 +2059,12 @@
      */
     function _urlencode($url) 
     {
-        return strtr($url, array(" "=>"%20",
-                                 "%"=>"%25",
-                                 "&"=>"%26",
-                                 "<"=>"%3C",
-                                 ">"=>"%3E",
-                                 ));
+        $ret = '';
+        $parts = explode ('/', $url);
+        array_shift ($parts);
+        foreach ($parts as $part)
+            $ret .= '/' . rawurlencode ($part);
+        return $ret;
     }
 
     /**


MfG, JBG

-- 
      Jan-Benedict Glaw      jbglaw at lug-owl.de              +49-172-7608481
Signature of:            http://www.chiark.greenend.org.uk/~sgtatham/bugs.html
the second  :
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-php-pear/attachments/20150703/6e8ac01b/attachment.sig>


More information about the pkg-php-pear mailing list