Defect #10673
openDot and comma in wiki pagename
0%
Description
RFC 1738 Uniform Resource Locators (URL) in part 2.2 said:
"Thus, only alphanumerics, the special characters "$-_.+!*'(),", and reserved characters used for their reserved purposes may be used unencoded within a URL."
But Redmine code disallow commas and dots in wiki page title. Why? Which reason for it?
Files
Related issues
Updated by Etienne Massip about 13 years ago
Updated by Alexander Oryol about 13 years ago
- File commas.patch commas.patch added
Yes, it is potentially conflict with rails ".format" feature.
Patch updated for commas-allow.
Updated by Alexander Oryol about 13 years ago
- File comma_allow.patch comma_allow.patch added
Patch updated. In routes.rb: needn't more :requirements => { :id => /.*/ }
Updated by Valery Bulash over 12 years ago
Someone - please, update these patches to 2.2.1-stable.
Evidently, routes.rb changed so much since that April'2012.
Updated by Zer Guz almost 9 years ago
+1 We need dots to be allowed. We have wiki pages that correspond to project versions and would like to call these the same.
Updated by Vladimir Perepechenko about 8 years ago
+1 We need dots to be allowed. We have wiki pages that correspond to project versions
Updated by Alex Moroz over 4 years ago
+1 We need dots to be allowed. We have wiki pages that correspond to project versions
Updated by T. Peter almost 4 years ago
+1 We need dots to be allowed. We have wiki pages that correspond to project versions
Same here
Updated by Jonathan Riedmair over 2 years ago
+1 We need dots to be allowed. We have wiki pages that correspond to project versions
Updated by Luc Luc about 1 month ago
- File allow-dots-and-commas-in-wiki-page-names.patch allow-dots-and-commas-in-wiki-page-names.patch added
Please find attached a patch for version 6.0.5 stable.
Updated by Holger Just about 1 month ago
Thank you for your work on this.
However, Redmine sometimes uses extensions at Wiki page URLs to denote various exported formats for the same resource. By appending .txt
to the URL of a page for example. you can get the raw textile or markdown for the page. By appending .html
, you can get get a simple rendered version of the page without much additional markup. There several other possible extensions in use for exports and for the REST API.
By ensuring that the actual wiki page identifier can not contain a dot, the URLs are guaranteed to be unambiguous. After this patch however, it is possible to have ambiguous URLs, e.g. if you would have a wiki page called welcome
and another called welcome.txt
, it's not clear what should happen if the welcome.txt
page is requested.
With just your patch, these wiki pages would break in any case. A possible workaround could be to disallow some named extensions. However, I don't believe that this is a good idea as it may result in previously valid wiki pages to become invalid if we introduce additional export extensions in the future, or it may force us (and all plugin authors) to stick to the extensions we have now without being able to add further functionality in the future, neither of which is an appealing option.
As such unfortunately, I believe that we can't properly support the use of a dot in wiki page titles at all given the current URL structure used by Redmine. Accordingly, I'm voting to close this issue as "won't fix" without merging the patch.
As a workaround, you may be able to use a underscore character (_
) instead of a dot in wiki page titles.
Updated by Luc Luc about 1 month ago
Holger Just wrote in #note-12:
Thank you for your work on this.
Thank you for taking the time to look at it.
However, Redmine sometimes uses extensions at Wiki page URLs to denote various exported formats for the same resource. [...]
Please accept my apologies for not properly investigating the possible side effects first and also for taking so much from your time to explain in detail the problems my patch is causing.
As such unfortunately, I believe that we can't properly support the use of a dot in wiki page titles at all given the current URL structure used by Redmine. Accordingly, I'm voting to close this issue as "won't fix" without merging the patch.
Absolutely understandable, I'm sorry again for the noise.
As a workaround, you may be able to use a underscore character (
_
) instead of a dot in wiki page titles.
I used the dot exclusively for wiki page names containing version information (e.g. "Version X.X.Z").
Considering your suggestions I will think about another approach.
Thank you again.
Updated by Holger Just 28 days ago
As for commas, I think they could technically be allowed in URLs. However, this would also require to at least adapt the parse_wiki_links
method in application_helper as well as the include
macro. I'm not sure if there would be any further side-effects there.
As a comma seems to be a rather obscure character in a wiki page title, I'm not sure if that change would be worth the possible compatibility issues which could be arising from this change if not all places are updated...
As such, I would still upload my "Won't Fix" vote for this entire issue.
Updated by Luc Luc 28 days ago
Disclaimer: I have close to nothing experience with the Redmine source code, I just do small hacks here and there to adapt it to my usage.
I uploaded my patch hoping it may help some people looking for dots (and commas) support in page names, but now I think it was a mistake, causing too much hassle considering all the implications you mentioned.
After your insights, for my own usage, after grep-ing a bit (without knowing for sure what I'm really looking for), I adapted the patch to work around the "export format" concept you mentioned above, but still allowing me to use dots in wiki page names.
It is probably a horrific hack, e.g.:
diff --git a/app/controllers/wiki_controller.rb b/app/controllers/wiki_controller.rb index 36b90da77..fff1474ed 100644 --- a/app/controllers/wiki_controller.rb +++ b/app/controllers/wiki_controller.rb @@ -353,8 +353,21 @@ class WikiController < ApplicationController render_404 end + def dummy_fix_format + if params[:id].nil? + return + end + accepted_formats = [".pdf", ".html", ".txt"] + ext = File.extname(params[:id]) + if accepted_formats.include? ext + params[:format] = ext[1..-1] + params[:id] = File.basename(params[:id], ext) + end + end + # Finds the requested page or a new page if it doesn't exist def find_existing_or_new_page + dummy_fix_format @page = @wiki.find_or_new_page(params[:id]) if @wiki.page_found_with_redirect? redirect_to_page @page @@ -363,6 +376,7 @@ class WikiController < ApplicationController # Finds the requested page and returns a 404 error if it doesn't exist def find_existing_page + dummy_fix_format @page = @wiki.find_page(params[:id]) if @page.nil? render_404
That's definitely not "production quality code" :-) but now the PDF, HTML and TXT exports and the dotted page names seems to work for my use case.
Probably I broke something else, but so far I didn't encountered any issues.
I didn't touch
parse_wiki_links
, I guess probably the required changes are already contained in Wiki.titleize
(the corresponding regular expression already being touched by the patch). Regarding the include
macro, I don't even know what that means.
Anyway, long story short, in my opinion you shouldn't take my patch too seriously and you shouldn't spend too much time trying to please dot worshipers if the intricacies of Redmine design are not really compatible with the "dot in page name" ideea.
"Won't Fix" vote works for me.