Skip to content

Commit

Permalink
Properly encode fragment mark in URLs
Browse files Browse the repository at this point in the history
Fixes the issue reported and fixed by Chong Kim in
http://rubyforge.org/tracker/?func=detail&atid=2679&aid=27774&group_id=678
where adding a link with a fragment failed.
  • Loading branch information
Hannes Wyss authored and hannes-wyss committed Feb 22, 2010
1 parent 67c9fc3 commit 0067695
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/spreadsheet/link.rb
Expand Up @@ -30,7 +30,7 @@ def initialize url='', description=url, fragment=nil
def href
href = (@url || @dos).to_s.dup
if @fragment
href << client('#') << @fragment
href << client('#', 'UTF-8') << @fragment
end
href
end
Expand Down
3 changes: 2 additions & 1 deletion test/integration.rb
Expand Up @@ -829,7 +829,7 @@ def test_write_new_workbook
sheet1[5,0] = 0.75
sheet1.row(5).set_format 0, fmt
link = Link.new 'http://scm.ywesee.com/?p=spreadsheet;a=summary',
'The Spreadsheet GitWeb'
'The Spreadsheet GitWeb', 'top'
sheet1[5,1] = link
sheet1[6,0] = 1
fmt = Format.new :color => 'green'
Expand Down Expand Up @@ -962,6 +962,7 @@ def test_write_new_workbook
url = @@iconv.iconv 'http://scm.ywesee.com/?p=spreadsheet;a=summary'
assert_equal @@iconv.iconv('The Spreadsheet GitWeb'), link
assert_equal url, link.url
assert_equal @@iconv.iconv('top'), link.fragment
row = sheet.row 6
assert_equal :green, row.format(0).font.color
assert_equal 1, row[0]
Expand Down

0 comments on commit 0067695

Please sign in to comment.