Bug #5227
400 during a svn checkout, file with special chars
0%
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?
Files
Related issues