Project

General

Profile

Bug #5227

400 during a svn checkout, file with special chars

Added by Carlo Truijllo over 2 years ago. Updated over 2 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
23.02.2017
Due date:
% Done:

0%

Estimated time:
Sorting:
Commit Number:
Affected Version:

Description

Our repository is behind apache ( configured to listen in 80 for web and 8090 svn ).

We can't control how our customers use their repository so we can't bring any naming convention in their files.

A customer added two files, more or less with this label:

  • Ricerca allo 0,75% del Pil.txt
  • L’hashtag #newHashtag non ancora.txt

Every attempt to checkout this repository lead to a 400 error because RhodeCode + Apache can't handle the improperly used reserved chars.

In apache logs:
Ricerca%20allo%200,75%%20del%20Pil.txt
instead
Ricerca%20allo%200,75%25%20del%20Pil.txt

and

L%E2%80%99hashtag%20#newHashtag%20non%20ancora.txt
instead
L%E2%80%99hashtag%20%23newHashtag%20non%20ancora.txt

I noticed URL come out plain and unescaped from RhodeCode ( to apache ) so I patched roughly the file :

/home/user/.rccontrol/community-1/profile/lib/python2.7/site-packages/rhodecode/lib/middleware/simplesvn.py

in this way:

--- old_simplesvn.py    2017-02-23 15:35:26.325978696 +0100
+++ new_simplesvn.py       2017-02-23 15:30:32.629978696 +0100
@@ -20,6 +20,7 @@

 import logging
 from urlparse import urljoin
+from urllib import quote

 import requests
 from webob.exc import HTTPNotAcceptable
@@ -62,8 +63,8 @@
         return response.iter_content(chunk_size=1024)

     def _get_url(self, path):
-        return urljoin(
-            self.config.get('subversion_http_server_url', ''), path)
+         return quote(urljoin(
+             self.config.get('subversion_http_server_url', ''), path), safe="/:=~+!$,;'")

     def _get_request_headers(self, environ):
         headers = {}

I know there is a wonderful RFC with all reserved chars listed but we are installing RhodeCode in a pre-existing svn environment.

Is there a cleaner way to manage this situation?

patch.txt (675 Bytes) patch.txt Carlo Truijllo, 23.02.2017 15:37

Related issues

Related to RhodeCode CE/EE - Bug #4306: Issue to push file with character # on a SVNResolved2016-11-09

History

#1 Updated by Marcin Kuzminski [staff] over 2 years ago

  • Related to Bug #4306: Issue to push file with character # on a SVN added

#2 Updated by Marcin Kuzminski [staff] over 2 years ago

HI Carlo,

Thanks for a report, and a patch. I think your solution is fine, we'll have a closer look but this looks sufficient.

Best,

Also available in: Atom PDF