Defect #27043 ยป 0001-Fix-broken-links-to-files-on-the-revision-page-when-.patch
| app/models/repository/subversion.rb | ||
|---|---|---|
| 117 | 117 |
# url = file:///var/svn/foo/bar |
| 118 | 118 |
# => returns /bar |
| 119 | 119 |
def relative_url |
| 120 |
@relative_url ||= url.gsub(Regexp.new("^#{Regexp.escape(root_url || scm.root_url)}", Regexp::IGNORECASE), '')
|
|
| 120 |
@relative_url ||= begin |
|
| 121 |
# root_url is the repository root reported by "svn info", which is |
|
| 122 |
# percent-encoded (e.g. file:///var/svn/foo%20bar) |
|
| 123 |
root = Addressable::URI.unencode((root_url || scm.root_url).to_s) |
|
| 124 |
url.gsub(Regexp.new("^#{Regexp.escape(root)}", Regexp::IGNORECASE), '')
|
|
| 125 |
end |
|
| 121 | 126 |
end |
| 122 | 127 |
end |
| test/unit/repository_subversion_test.rb | ||
|---|---|---|
| 112 | 112 |
end |
| 113 | 113 |
end |
| 114 |
def test_relative_path_should_handle_percent_encoded_root_url |
|
| 115 |
repository = |
|
| 116 |
Repository::Subversion.new( |
|
| 117 |
:project => @project, |
|
| 118 |
:url => 'file:///svn/repo with spaces/trunk', |
|
| 119 |
:root_url => 'file:///svn/repo%20with%20spaces' |
|
| 120 |
) |
|
| 121 |
assert_equal '/dir/file.txt', repository.relative_path('/trunk/dir/file.txt')
|
|
| 122 |
end |
|
| 123 | ||
| 114 | 124 |
if repository_configured?('subversion')
|
| 115 | 125 |
def test_fetch_changesets_from_scratch |
| 116 | 126 |
assert_equal 0, @repository.changesets.count |