Commit 78379f66 authored by Douwe Maan's avatar Douwe Maan

Strip trailing whitespace in relative submodule URL

parent 585e6aa5
...@@ -73,6 +73,7 @@ module SubmoduleHelper ...@@ -73,6 +73,7 @@ module SubmoduleHelper
end end
def relative_self_links(url, commit) def relative_self_links(url, commit)
url.rstrip!
# Map relative links to a namespace and project # Map relative links to a namespace and project
# For example: # For example:
# ../bar.git -> same namespace, repo bar # ../bar.git -> same namespace, repo bar
......
---
title: Strip trailing whitespace in relative submodule URL
merge_request:
author:
...@@ -170,6 +170,11 @@ describe SubmoduleHelper do ...@@ -170,6 +170,11 @@ describe SubmoduleHelper do
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"]) expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end end
it 'with trailing whitespace' do
result = relative_self_links('../test.git ', commit_id)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
end
it 'two levels down' do it 'two levels down' do
result = relative_self_links('../../test.git', commit_id) result = relative_self_links('../../test.git', commit_id)
expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"]) expect(result).to eq(["/#{group.path}/test", "/#{group.path}/test/tree/#{commit_id}"])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment