Patch #2856

Redmine::WikiFormatting.register not raise ArgumentError

Added by Narihiro Nakamura over 8 years ago. Updated over 8 years ago.

Status:ClosedStart date:2009-02-27
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:-
Target version:0.9.0

Description

Hi.

Redmine::WikiFormatting.register not raise ArgumentError.

./script/console
001:>> Redmine::WikiFormatting.register("foo", "bar", "baz") #=> {:helper=>"baz", :formatter=>"bar"}
002:>> Redmine::WikiFormatting.register("foo", "bar", "baz") #=> {:helper=>"baz", :formatter=>"bar"}
003:>> Redmine::WikiFormatting.register("foo", "bar", "baz") #=> {:helper=>"baz", :formatter=>"bar"}

I maked patch for fix this bug.

./script/console
001:>Redmine::WikiFormatting.register("foo", "bar", "baz") #=> {:helper=>"baz", :formatter=>"bar"}
002:>> Redmine::WikiFormatting.register("foo", "bar", "baz")
ArgumentError: format name 'foo' is already taken

thanks.

Index: lib/redmine/wiki_formatting.rb
===================================================================
--- lib/redmine/wiki_formatting.rb      (revision 2480)
+++ lib/redmine/wiki_formatting.rb      (working copy)
@@ -25,7 +25,7 @@
       end

       def register(name, formatter, helper)
-        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name]
+        raise ArgumentError, "format name '#{name}' is already taken" if @@formatters[name.to_sym]
         @@formatters[name.to_sym] = {:formatter => formatter, :helper => helper}
       end

Associated revisions

Revision 2562
Added by Jean-Philippe Lang over 8 years ago

Fixes that Redmine::WikiFormatting.register did not raise ArgumentError when giving name as a string (#2856).

History

#1 Updated by Jean-Philippe Lang over 8 years ago

  • Status changed from New to Closed
  • Target version set to 0.9.0

Applied in r2562. Thanks.

Also available in: Atom PDF