Re: [chora] Chora problems with Non-ASCII character filenames
Frank Rust <[email protected]> Fri, 14 Jan 2011 12:50:24 +0100
| Newsgroups | gmane.comp.horde.devel,gmane.comp.horde.chora |
|---|---|
| Message-ID | <[email protected]> |
This message is in MIME format. --=_wjy3v445mzev4 Content-Type: text/plain; charset=ISO-8859-1; DelSp="Yes"; format="flowed" Content-Disposition: inline Content-Transfer-Encoding: 7bit Quoting Frank Rust <[email protected]>: > Hi, > > I have a problem with chora (latest stable versions of horde & chora). > When browsing through svn repositories containing files with > non-ASCII characters I get an error > > : Error executing svn log: svn: URL > 'svn://my.svn.host/svn/a//M/k/?\195?\156berblick.ppt' is not > properly URI-encoded > > Can someone point me to a patch? > I did it mysqlf. Maybe someone is interrested in my solution. There needs to be done some clean-up to put it to public... It was needed to patch the horde/VC/svn.php, chora/annotate.php, chora/browse.php, chora/co.php, and chora/lib/Chora.php. Best regards, Frank. ---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program. --=_wjy3v445mzev4 Content-Type: text/x-diff; charset=ISO-8859-1; name="chora-h3-2.1.1+utf8_filenames.patch" Content-Disposition: attachment; filename="chora-h3-2.1.1+utf8_filenames.patch" Content-Transfer-Encoding: 7bit diff -u -r -x config chora-h3-2.1.1/annotate.php chora/annotate.php --- chora-h3-2.1.1/annotate.php 2009-01-06 16:22:34.000000000 +0100 +++ chora/annotate.php 2011-01-14 11:17:26.000000000 +0100 @@ -27,7 +27,9 @@ $ann = &$VC->getAnnotateObject($fl); Chora::checkError($lines = $ann->doAnnotate($rev)); -$title = sprintf(_("Source Annotation of %s (revision %s)"), Text::htmlAllSpaces($where), $rev); +$p=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$where) ); + +$title = sprintf(_("Source Annotation of %s (revision %s)"), $p, $rev); $extraLink = sprintf('<a href="%s">%s</a> | <a href="%s">%s</a>', Chora::url('co', $where, array('r' => $rev)), _("View"), Chora::url('co', $where, array('r' => $rev, 'p' => 1)), _("Download")); diff -u -r -x config chora-h3-2.1.1/browse.php chora/browse.php --- chora-h3-2.1.1/browse.php 2009-01-06 16:22:34.000000000 +0100 +++ chora/browse.php 2011-01-14 11:24:59.000000000 +0100 @@ -32,7 +32,8 @@ if ($where == '') { $title = $conf['options']['introTitle']; } else { - $title = sprintf(_("Source Directory of /%s"), $where); +$p=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$where) ); + $title = sprintf(_("Source Directory of /%s"), $p ); } $extraLink = ''; @@ -85,6 +86,7 @@ } $url = Chora::url('', "$where/$currentDir/"); $currDir = Text::htmlAllSpaces($currentDir); +$currDir=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$currDir) ); require CHORA_TEMPLATES . '/directory/dir.inc'; } echo '</tbody>'; @@ -132,6 +134,7 @@ $attic = $currFile->isAtticFile(); $fileName = $where . ($attic ? '/' . 'Attic' : '') . '/' . $realname; $name = Text::htmlAllSpaces($realname); +$name=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$name) ); $url = Chora::url('', $fileName); $readableDate = Chora::readableTime($date); if ($log) { @@ -154,7 +157,8 @@ /* Showing a file. */ $fl = &$VC->getFileObject($where, $cache); Chora::checkError($fl); -$title = sprintf(_("Revisions for %s"), $where); +$p=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$where) ); +$title = sprintf(_("Revisions for %s"), $p); $onb = Util::getFormData('onb', 0); if (VC_Revision::valid($onb)) { $onb_len = strlen($onb); diff -u -r -x config chora-h3-2.1.1/co.php chora/co.php --- chora-h3-2.1.1/co.php 2009-01-06 16:22:34.000000000 +0100 +++ chora/co.php 2011-01-14 11:13:23.000000000 +0100 @@ -81,8 +81,9 @@ /* Get this revision's attributes in printable form. */ $log = $file->logs[$r]; +$p=utf8_decode( preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)', basename($fullname) ) ); $title = sprintf(_("%s Revision %s (%s ago)"), - basename($fullname), + $p, $r, Chora::readableTime($log->date, true)); $extraLink = sprintf('<a href="%s">%s</a> | <a href="%s">%s</a>', diff -u -r -x config chora-h3-2.1.1/lib/Chora.php chora/lib/Chora.php --- chora-h3-2.1.1/lib/Chora.php 2008-10-09 19:40:05.000000000 +0200 +++ chora/lib/Chora.php 2011-01-14 10:44:31.000000000 +0100 @@ -202,7 +202,8 @@ } $wherePath = str_replace('//', '/', $wherePath); if (!empty($dir) && ($dir != 'Attic')) { - $bar .= '/ <a href="' . Chora::url('', $wherePath) . '">'. Text::htmlallspaces($dir) . '</a> '; +$p=utf8_decode(preg_replace('|\?\\\([0-9][0-9][0-9])\?\\\([0-9][0-9][0-9])|e','chr($1).chr($2)',$dir) ); + $bar .= '/ <a href="' . Chora::url('', $wherePath) . '">'. Text::htmlallspaces($p) . '</a> '; } } return $bar; --=_wjy3v445mzev4 Content-Type: text/x-diff; charset=ISO-8859-1; name="horde-3.3.11+VC_utf8.patch" Content-Disposition: attachment; filename="horde-3.3.11+VC_utf8.patch" Content-Transfer-Encoding: 7bit diff -r -u -x config horde-3.3.11/lib/Horde/MIME/Viewer/simple.php horde3-new/lib/Horde/MIME/Viewer/simple.php --- horde-3.3.11/lib/Horde/MIME/Viewer/simple.php 2010-11-23 01:22:36.000000000 +0100 +++ horde3-new/lib/Horde/MIME/Viewer/simple.php 2011-01-13 11:33:15.000000000 +0100 @@ -26,6 +26,7 @@ function render($params = array()) { // Bug #8311: Unknown text parts should not be rendered inline. + require_once 'Horde/MIME/Contents.php'; return MIME_Contents::viewAsAttachment() ? parent::render($params) : _("Can not display contents of text part inline."); diff -r -u -x config horde-3.3.11/lib/Horde/VC/svn.php horde3-new/lib/Horde/VC/svn.php --- horde-3.3.11/lib/Horde/VC/svn.php 2010-11-23 01:22:36.000000000 +0100 +++ horde3-new/lib/Horde/VC/svn.php 2011-01-14 08:34:45.000000000 +0100 @@ -133,7 +133,10 @@ } $Q = VC_WINDOWS ? '"' : "'"; - $command = $this->SVN->getCommand() . ' annotate -r 1:' . $rev . ' ' . $Q . str_replace($Q, '\\' . $Q, $this->file->queryFullPath()) . $Q . ' 2>&1'; + +$p=preg_replace('|\?\\\([0-9][0-9][0-9])|e','"%".dechex($1)',$this->file->queryFullPath()); + $command = $this->SVN->getCommand() . ' annotate -r 1:' . $rev . ' ' . $Q . str_replace($Q, '\\' . $Q, $p ) . $Q . ' 2>&1'; +Horde::logMessage("SVN >".$command."<" , __FILE__, __LINE__, PEAR_LOG_DEBUG); $pipe = popen($command, 'r'); if (!$pipe) { return PEAR::raiseError('Failed to execute svn annotate: ' . $command); @@ -190,8 +193,10 @@ $Q = "'"; $mode = 'r'; } - - if (!($RCS = popen($rep->getCommand() . ' cat -r ' . $rev . ' ' . $Q . str_replace($Q, '\\' . $Q, $fullname) . $Q . ' 2>&1', $mode))) { +$p=preg_replace('|\?\\\([0-9][0-9][0-9])|e','"%".dechex($1)',$fullname); + $cmd=$rep->getCommand() . ' cat -r ' . $rev . ' ' . $Q . str_replace($Q, '\\' . $Q, $p) . $Q . ' 2>&1'; +Horde::logMessage("SVN >".$cmd."<" , __FILE__, __LINE__, PEAR_LOG_DEBUG); + if (!($RCS = popen($cmd, $mode))) { return PEAR::raiseError('Couldn\'t perform checkout of the requested file'); } @@ -265,7 +270,9 @@ // TODO: add options for $hr options - however these may not // be compatible with some diffs. $Q = VC_WINDOWS ? '"' : "'"; - $command = $rep->getCommand() . " diff --diff-cmd " . $rep->getPath('diff') . " -r $rev1:$rev2 -x " . $Q . $options . $Q . ' ' . $Q . $file->queryFullPath() . $Q . ' 2>&1'; +$p=preg_replace('|\?\\\([0-9][0-9][0-9])|e','"%".dechex($1)',$rep->getPath('diff')); + $command = $rep->getCommand() . " diff --diff-cmd " . $p . " -r $rev1:$rev2 -x " . $Q . $options . $Q . ' ' . $Q . $p . $Q . ' 2>&1'; +Horde::logMessage("SVN >".$command."<" , __FILE__, __LINE__, PEAR_LOG_DEBUG); exec($command, $diff, $retval); return $diff; @@ -346,7 +353,10 @@ function browseDir($cache = null, $quicklog = true, $showattic = false) { $Q = VC_WINDOWS ? '"' : "'" ; - $cmd = $this->rep->getCommand() . ' ls ' . $Q . str_replace($Q, '\\' . $Q, $this->rep->sourceroot() . $this->queryDir()) . $Q . ' 2>&1'; + +$p=preg_replace('|\?\\\([0-9][0-9][0-9])|e','"%".dechex($1)',$this->queryDir()); + $cmd = $this->rep->getCommand() . ' ls ' . $Q . str_replace($Q, '\\' . $Q, $this->rep->sourceroot() . $p ) . $Q . ' 2>&1'; +Horde::logMessage("SVN >".$cmd."<" , __FILE__, __LINE__, PEAR_LOG_DEBUG); $dir = popen($cmd, 'r'); if (!$dir) { @@ -689,7 +699,9 @@ * $flag = $this->quicklog ? '-r HEAD ' : ''; */ $flag = ''; $Q = VC_WINDOWS ? '"' : "'"; - $cmd = $this->rep->getCommand() . ' log -v ' . $flag . $Q . str_replace($Q, '\\' . $Q, $this->queryFullPath()) . $Q . ' 2>&1'; +$p=preg_replace('|\?\\\([0-9][0-9][0-9])|e','"%".dechex($1)',$this->queryFullPath()); + $cmd = $this->rep->getCommand() . ' log -v ' . $flag . $Q . str_replace($Q, '\\' . $Q, $p ) . $Q . ' 2>&1'; +Horde::logMessage("SVN >".$cmd."<" , __FILE__, __LINE__, PEAR_LOG_DEBUG); $pipe = popen($cmd, 'r'); if (!$pipe) { return PEAR::raiseError('Failed to execute svn log: ' . $cmd); --=_wjy3v445mzev4 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline -- Horde developers mailing list Frequently Asked Questions: http://horde.org/faq/ To unsubscribe, mail: [email protected] --=_wjy3v445mzev4--