dot-comma.patch

Alexander Oryol, 2012-04-16 12:25

Download (3.69 KB)

View differences:

app/models/wiki.rb
89 89
  # turn a string into a valid page title
90 90
  def self.titleize(title)
91 91
    # replace spaces with _ and remove unwanted caracters
92
    title = title.gsub(/\s+/, '_').delete(',./?;|:') if title
92
    title = title.gsub(/\s+/, '_').delete('/?;|:') if title
93 93
    # upcase the first letter
94 94
    title = (title.slice(0..0).upcase + (title.slice(1..-1) || '')) if title
95 95
    title
app/models/wiki_page.rb
40 40
  attr_accessor :redirect_existing_links
41 41

  
42 42
  validates_presence_of :title
43
  validates_format_of :title, :with => /^[^,\.\/\?\;\|\s]*$/
43
  validates_format_of :title, :with => /^[^\/\?\;\|\s]*$/
44 44
  validates_uniqueness_of :title, :scope => :wiki_id, :case_sensitive => false
45 45
  validates_associated :content
46 46

  
config/routes.rb
20 20
              :conditions => {:method => :get}
21 21

  
22 22
  map.connect 'projects/:id/wiki', :controller => 'wikis',
23
              :action => 'edit', :conditions => {:method => :post}
23
              :action => 'edit', :conditions => {:method => :post}, :requirements => { :id => /.*/ }
24 24
  map.connect 'projects/:id/wiki/destroy', :controller => 'wikis',
25
              :action => 'destroy', :conditions => {:method => [:get, :post]}
25
              :action => 'destroy', :conditions => {:method => [:get, :post]}, :requirements => { :id => /.*/ }
26 26

  
27 27
  map.with_options :controller => 'messages' do |messages_routes|
28 28
    messages_routes.with_options :conditions => {:method => :get} do |messages_views|
......
181 181

  
182 182
    project.wiki_start_page 'wiki', :controller => 'wiki', :action => 'show', :conditions => {:method => :get}
183 183
    project.wiki_index 'wiki/index', :controller => 'wiki', :action => 'index', :conditions => {:method => :get}
184
    project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil
185
    project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff'
186
    project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate'
184
    project.wiki_diff 'wiki/:id/diff/:version', :controller => 'wiki', :action => 'diff', :version => nil, :requirements => { :id => /.*/ }
185
    project.wiki_diff 'wiki/:id/diff/:version/vs/:version_from', :controller => 'wiki', :action => 'diff', :requirements => { :id => /.*/ }
186
    project.wiki_annotate 'wiki/:id/annotate/:version', :controller => 'wiki', :action => 'annotate', :requirements => { :id => /.*/ }
187 187
    project.resources :wiki, :except => [:new, :create], :member => {
188 188
      :rename => [:get, :post],
189 189
      :history => :get,
......
193 193
    }, :collection => {
194 194
      :export => :get,
195 195
      :date_index => :get
196
    }
196
    }, :requirements => { :id => /.*/ }
197 197
  end
198 198

  
199 199
  map.connect 'news', :controller => 'news', :action => 'index'
200
-