Defect #12749

Plugins cannot route wiki page sub-path

Added by Ruedi Silvestri almost 5 years ago. Updated almost 5 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

0%

Category:Plugin API
Target version:2.2.2
Resolution:Fixed Affected version:2.2.0

Description

I've got "Graphviz Wiki-macro Plugin" (https://github.com/tckz/redmine-wiki_graphviz_plugin) installed which introduces macro's to inject dynamically generated graphs into wiki pages. With 2.2 such doesn't work anymore as a new route has been introduced in redmine routes.rb:
get 'wiki/:id/:version', :to => 'wiki#show'

Due to the fact that any additional route is catched by this approach the routes.rb of the respective plugin cannot introduce additional sub-pages to the wiki pages.
Easiest way to work around this would be to have an identifier added for wiki versions resulting to a route as:
get 'wiki/:id/version/:version', :to => 'wiki#show'

For now in my environment I just commented this very route and it works as the default access to older versions of wiki pages is anyway by projects/:id/wiki/:id?version=:version

Associated revisions

Revision 11166
Added by Jean-Philippe Lang almost 5 years ago

Plugins cannot route wiki page sub-path (#12749).

History

#1 Updated by Jean-Philippe Lang almost 5 years ago

Maybe this patch would fix this problem:

Index: config/routes.rb
===================================================================
--- config/routes.rb    (revision 11111)
+++ config/routes.rb    (working copy)
@@ -157,7 +157,7 @@
       end
     end
     match 'wiki', :controller => 'wiki', :action => 'show', :via => :get
-    get 'wiki/:id/:version', :to => 'wiki#show'
+    get 'wiki/:id/:version', :to => 'wiki#show', :constraints => {:version => /\d+/}
     delete 'wiki/:id/:version', :to => 'wiki#destroy_version'
     get 'wiki/:id/:version/annotate', :to => 'wiki#annotate'
     get 'wiki/:id/:version/diff', :to => 'wiki#diff'

Can you confirm?

#2 Updated by Ruedi Silvestri almost 5 years ago

Just finished my testing of this and things look perfect with this approach. Much appreciated for prompt fix of the issue. 2.2 looks awesome to me, great job.

#3 Updated by Ruedi Silvestri almost 5 years ago

  • Status changed from New to Resolved

just missed to change the status. :)

#4 Updated by Jean-Philippe Lang almost 5 years ago

  • Target version set to 2.2.2

#5 Updated by Jean-Philippe Lang almost 5 years ago

  • Subject changed from Routes entry # "get 'wiki/:id/:version', :to => 'wiki#show' " prevents plugins to use sub-path for wiki to Plugins cannot route wiki page sub-path
  • Category changed from Wiki to Plugin API
  • Status changed from Resolved to Closed
  • Assignee set to Jean-Philippe Lang
  • Resolution set to Fixed

Fix committed in r11166, thanks for the feedback.

Also available in: Atom PDF