diff --git a/lib/redmine_dmsf/webdav/controller.rb b/lib/redmine_dmsf/webdav/controller.rb index 3a6deb1f..963961e6 100644 --- a/lib/redmine_dmsf/webdav/controller.rb +++ b/lib/redmine_dmsf/webdav/controller.rb @@ -60,14 +60,14 @@ module RedmineDmsf find_resources.each do |resource| xml.response do unless(resource.propstat_relative_path) - xml.href "#{scheme}://#{host}:#{port}#{url_format(resource)}" + xml.href "#{scheme}://#{host}:#{port}#{url_format(resource)}" else xml.href url_format(resource) end propstats(xml, get_properties(resource, properties.empty? ? resource.properties : properties)) end end - end + end end end @@ -115,6 +115,13 @@ module RedmineDmsf end end + # Escape URL string + def url_format(resource) + # Additionally escape square brackets, otherwise files with + # file name like file[1].pdf are not visible in some WebDAV clients + URI.encode(super, '[]') + end + end end end \ No newline at end of file