Defect #27043
closedSubversion repositories with spaces in the root URL cause broken file and diff links on the revision page
Description
Our Subversion repository naming structure incorporates spaces in it (http://some.url/svn/repo with spaces/), and it seems this is not working perfectly in Redmine. I can see the files within the repository, however if I try and view a file or the diff of a file, I get a "404 The entry or revision was not found in the repository.". If I try the same thing with a different repository with no spaces in the name, it works as I believe it should (can view / diff files). Interestingly, if I go to a specific revision and 'View differences' it will do a diff of all of the changes in that revision perfectly fine, it's only upon diffing / viewing a single file that it fails.
I have tried replacing the spaces with %20, however this stops me being able to browse the repo at all. I have tried putting the repo string in quotes, however this is not accepted by Redmine as quotes are considered an invalid character in that box.
Having a space in a file name doesn't cause any issues with regards to viewing / diffing, it's just with the repo itself.
The resolution in #7505 shows the repo browsing to be working as intended (like it is for me), however upon attempting to view those files in Redmine is where the issue appears.
Files
Related issues
Updated by Toshi MARUYAMA almost 9 years ago
- Related to Defect #7505: Subversion: Repository URL with space not handled correctly added
Updated by Go MAEDA 19 days ago
- File 0001-Fix-broken-links-to-files-on-the-revision-page-when-.patch 0001-Fix-broken-links-to-files-on-the-revision-page-when-.patch added
- Status changed from New to Confirmed
- Target version set to Candidate for next minor release
I have confirmed this problem on the current trunk (r25119). It occurs only when the repository URL set in Redmine points to a subdirectory of the repository, such as http://example.net/svn/repo with spaces/trunk. It does not occur when the URL points to the repository root, such as http://example.net/svn/repo with spaces.
The cause is in Repository::Subversion#relative_url. This method removes the root URL from the beginning of the repository URL to obtain the path of the subdirectory (/trunk). Redmine then strips this path from the changed paths on the revision page to make them relative to the repository URL (/trunk/dir/file.txt becomes /dir/file.txt).
However, the root URL is obtained from svn info and is percent-encoded (repo%20with%20spaces), while the repository URL is stored as entered by the user, with spaces. Since the repository URL does not start with the encoded root URL, the method returns the whole repository URL instead of /trunk. As a result, nothing is stripped from the changed paths, and the links to files and their diffs on the revision page point to trunk/dir/file.txt instead of dir/file.txt.
The attached patch fixes this by decoding the root URL before removing it from the repository URL.
Updated by Go MAEDA 14 days ago
- Subject changed from SVN repos with spaces allow for browsing but not file viewing to Subversion repositories with spaces in the root URL cause broken file and diff links on the revision page
- Status changed from Confirmed to Resolved
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the fix in r25133.
Thank you for reporting this issue.