RhodeCode - issues: Issueshttps://issues.rhodecode.com/https://issues.rhodecode.com/favicon.ico?16960560042017-02-23T15:43:57ZRhodeCode - issues
Redmine RhodeCode CE/EE - Bug #5227 (New): 400 during a svn checkout, file with special charshttps://issues.rhodecode.com/issues/52272017-02-23T15:43:57ZCarlo Truijllo
<p>Our repository is behind apache ( configured to listen in 80 for web and 8090 svn ).</p>
<p>We can't control how our customers use their repository so we can't bring any naming convention in their files.</p>
<p>A customer added two files, more or less with this label:</p>
<ul>
<li>Ricerca allo 0,75% del Pil.txt</li>
<li>L’hashtag #newHashtag non ancora.txt</li>
</ul>
<p>Every attempt to checkout this repository lead to a 400 error because RhodeCode + Apache can't handle the improperly used reserved chars.</p>
<p>In apache logs:<br>
Ricerca%20allo%200,75%%20del%20Pil.txt<br>
instead<br>
Ricerca%20allo%200,75%25%20del%20Pil.txt</p>
<p>and </p>
<p>L%E2%80%99hashtag%20#newHashtag%20non%20ancora.txt<br>
instead<br>
L%E2%80%99hashtag%20%23newHashtag%20non%20ancora.txt</p>
<p>I noticed URL come out plain and unescaped from RhodeCode ( to apache ) so I patched roughly the file :</p>
<p>/home/user/.rccontrol/community-1/profile/lib/python2.7/site-packages/rhodecode/lib/middleware/simplesvn.py</p>
<p>in this way:</p>
<pre><code>--- 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 = {}
</code></pre>
<p>I know there is a wonderful RFC with all reserved chars listed but we are installing RhodeCode in a pre-existing svn environment.</p>
<p>Is there a cleaner way to manage this situation?</p>