Changed project webdav path to -id- instead of [id].

This commit is contained in:
COLA@Redminetest 2017-03-17 14:01:15 +01:00
parent c1264b4f61
commit a973b63214
2 changed files with 3 additions and 3 deletions

View File

@ -168,7 +168,7 @@ module RedmineDmsf
pinfo = @path.split('/').drop(1)
if pinfo.length > 0
if use_project_names
unless pinfo.first.match('(\[([0-9]+)\])$').nil?
unless pinfo.first.match('(-([0-9]+)-)$').nil?
pid = $2
begin
@project = Project.find_by_id(pid)

View File

@ -117,7 +117,7 @@ module RedmineDmsf
end
# Characters that MATCH this regex will be replaced with dots, no more than one dot in a row.
INVALID_CHARACTERS = /[\/\\\?":<>#%\*]/.freeze # = / \ ? " : < > # % *
INVALID_CHARACTERS = /[\/\\\?":<>#%\*\[\]]/.freeze # = / \ ? " : < > # % * [ ]
def self.create_project_name(p)
use_project_names = Setting.plugin_redmine_dmsf['dmsf_webdav_use_project_names']
@ -125,7 +125,7 @@ module RedmineDmsf
# 1. Invalid characters are replaced with a dot.
# 2. Two or more dots in a row are replaced with a single dot.
# (3. Windows WebClient does not like a dot at the end, but since the project id tag is appended this is not a problem.)
"#{p.name.gsub(INVALID_CHARACTERS, ".").gsub(/\.{2,}/, ".")} [#{p.id}]" unless p.nil?
"#{p.name.gsub(INVALID_CHARACTERS, ".").gsub(/\.{2,}/, ".")} -#{p.id}-" unless p.nil?
else
p.identifier unless p.nil?
end