Feature #8930

Model document need a valid filename as title

Added by Hans Schmidt almost 8 years ago. Updated almost 6 years ago.

Status:ClosedStart date:2011-07-28
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Plugin API
Target version:-
Resolution:

Description

I use the WebDav-Plugin to manage my documentes.
With Redmine i can create a new document with caracters(< > ? " : | \ / *) that cant handle by windows.

All i need is to add a "validates_format_of" in app/models/document.rb with regex /\A([^<>\?":\|\\\/\*]+)\Z/i.
The Regex filters the caracters(< > ? " : | \ / *). If one of these found, we get an error.

After line 30:

...
validates_presence_of :project, :title, :category
validates_length_of :title, :maximum => 60
# valid title (filename) for Windows
validates_format_of :title, :with => /\A([^<>\?":\|\\\/\*]+)\Z/i, :on => :save

named_scope :visible, lambda {|*args| { :include => :project,
                                          :conditions => Project.allowed_to_condition(args.shift || User.current, :view_documents, *args) } }
...

Source: http://en.wikipedia.org/wiki/8.3_filename#Directory_table

This excludes the following ASCII characters:
" * / : < > ? \ |
Windows/MSDOS has no shell escape character

I hope u add this to core :)

History

#1 Updated by Terence Mill almost 8 years ago

+1 to be able to use "PluginWebDav":projects/redmine/wiki/PluginWebDav with windows.

Its more a bug in context of the plugin than a feature.

#2 Updated by Jean-Baptiste Barth almost 6 years ago

  • Status changed from New to Closed

Old issue + this could be done in the plugin I think

Also available in: Atom PDF