DMSF doesn't ignore filepattern when LOCK and UNLOCK requests. #1495
This commit is contained in:
parent
0a51b6e556
commit
962c3a8f23
@ -439,6 +439,8 @@ module RedmineDmsf
|
|||||||
unless exist?
|
unless exist?
|
||||||
# A successful lock request to an unmapped URL MUST result in the creation of a locked (non-collection)
|
# A successful lock request to an unmapped URL MUST result in the creation of a locked (non-collection)
|
||||||
# resource with empty content.
|
# resource with empty content.
|
||||||
|
return NoContent if ignore?
|
||||||
|
|
||||||
f = create_empty_file
|
f = create_empty_file
|
||||||
if f
|
if f
|
||||||
scope = "scope_#{args[:scope] || 'exclusive'}".to_sym
|
scope = "scope_#{args[:scope] || 'exclusive'}".to_sym
|
||||||
@ -544,13 +546,8 @@ module RedmineDmsf
|
|||||||
raise Forbidden
|
raise Forbidden
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ignore file name patterns given in the plugin settings
|
return NoContent if ignore?
|
||||||
pattern = Setting.plugin_redmine_dmsf['dmsf_webdav_ignore']
|
|
||||||
pattern = /^(\._|\.DS_Store$|Thumbs.db$)/ if pattern.blank?
|
|
||||||
if basename.match(pattern)
|
|
||||||
Rails.logger.info "#{basename} ignored"
|
|
||||||
return NoContent
|
|
||||||
end
|
|
||||||
reuse_revision = false
|
reuse_revision = false
|
||||||
if exist? # We're over-writing something, so ultimately a new revision
|
if exist? # We're over-writing something, so ultimately a new revision
|
||||||
f = file
|
f = file
|
||||||
@ -791,13 +788,24 @@ module RedmineDmsf
|
|||||||
|
|
||||||
r.custom_field_values << CustomValue.new({ custom_field: cf, value: cf.default_value })
|
r.custom_field_values << CustomValue.new({ custom_field: cf, value: cf.default_value })
|
||||||
end
|
end
|
||||||
if r.save(validate: false) # Skip validation due to invalid characters in the filename
|
if r.save(validate: false) # Skip validation due to invalid characters in the filename
|
||||||
FileUtils.touch r.disk_file(search_if_not_exists: false)
|
FileUtils.touch r.disk_file(search_if_not_exists: false)
|
||||||
return f
|
return f
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
nil
|
nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ignore?
|
||||||
|
# Ignore file name patterns given in the plugin settings
|
||||||
|
pattern = Setting.plugin_redmine_dmsf['dmsf_webdav_ignore']
|
||||||
|
pattern = /^(\._|\.DS_Store$|Thumbs.db$)/ if pattern.blank?
|
||||||
|
if basename.match(pattern)
|
||||||
|
Rails.logger.info "#{basename} ignored"
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user