Project

General

Profile

Actions

Feature #8930

closed

Model document need a valid filename as title

Added by Hans Schmidt over 12 years ago. Updated almost 11 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Plugin API
Target version:
-
Start date:
2011-07-28
Due date:
% Done:

0%

Estimated time:
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 :)

Actions #1

Updated by Terence Mill over 12 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.

Actions #2

Updated by Jean-Baptiste Barth almost 11 years ago

  • Status changed from New to Closed

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

Actions

Also available in: Atom PDF