File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -74,7 +74,9 @@ def redirect_prefix(site)
7474
7575 def config_github_url ( site )
7676 github_config = site . config [ 'github' ]
77- github_config [ 'url' ] if github_config . is_a? ( Hash )
77+ if github_config . is_a? ( Hash ) && github_config [ 'url' ]
78+ github_config [ 'url' ] . to_s
79+ end
7880 end
7981
8082 def config_baseurl ( site )
Original file line number Diff line number Diff line change 8888 expect ( redirector . redirect_url ( @site , page_with_one ) ) . to start_with ( "http://example.github.io/test" )
8989 end
9090
91+ it "converts non-string values in site.github.url to strings" do
92+ @site . config [ 'github' ] = { "url" => TestStringContainer . new ( "http://example.github.io/test" ) }
93+ expect ( redirector . redirect_url ( @site , page_with_one ) ) . to start_with ( "http://example.github.io/test" )
94+ end
95+
9196 it "uses site.baseurl as the redirect prefix when site.github.url is not set" do
9297 @site . config [ 'baseurl' ] = "/fancy/prefix"
9398 expect ( redirector . redirect_url ( @site , page_with_one ) ) . to start_with ( "/fancy/prefix" )
Original file line number Diff line number Diff line change @@ -79,3 +79,13 @@ def destination_sitemap
7979 File . read ( File . join ( @dest . to_s , 'sitemap.xml' ) )
8080 end
8181end
82+
83+ class TestStringContainer
84+ def initialize ( strValue )
85+ @val = strValue
86+ end
87+
88+ def to_s
89+ @val
90+ end
91+ end
You can’t perform that action at this time.
0 commit comments