From 63f8c9271235d21b4857e6f95032ce64ca10467f Mon Sep 17 00:00:00 2001
From: "karel.picman@lbcfree.net"
+ <%= content_tag(:label, l(:dmsf_webdav_ignore_1b_file_for_authentication)) %> + <%= check_box_tag 'settings[dmsf_webdav_ignore_1b_file_for_authentication]', true, @settings['dmsf_webdav_ignore_1b_file_for_authentication'], size: 50 %> + + <%= l(:dmsf_webdav_ignore_1b_file_for_authentication_info) %> <%= l(:label_default) %>: <%= l(:general_text_Yes)%> + +
<%= content_tag :label, l(:label_webdav_disable_versioning) %> <%= text_field_tag 'settings[dmsf_webdav_disable_versioning]', @settings['dmsf_webdav_disable_versioning'], size: 50 %> diff --git a/config/locales/cs.yml b/config/locales/cs.yml index 1f649292..f2ab9d1e 100644 --- a/config/locales/cs.yml +++ b/config/locales/cs.yml @@ -408,6 +408,9 @@ cs: label_add_width: Přidat s + dmsf_webdav_ignore_1b_file_for_authentication: Ignorovat 1b soubor poslaný kvůli autentizaci + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/de.yml b/config/locales/de.yml index 11c97ec5..71976732 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -407,6 +407,9 @@ de: label_add_width: Zugeben mit + dmsf_webdav_ignore_1b_file_for_authentication: Ignoriern 1b Datai geschickt wegen der Autorization + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: Von mir gesperrte Dokumente diff --git a/config/locales/en.yml b/config/locales/en.yml index 67683d18..c9db8078 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -408,6 +408,9 @@ en: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/es.yml b/config/locales/es.yml index ffbc7cc5..877caf17 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -408,6 +408,9 @@ es: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f52f5500..6cab938c 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -408,6 +408,9 @@ fr: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/hu.yml b/config/locales/hu.yml index ceeff068..86fb755a 100644 --- a/config/locales/hu.yml +++ b/config/locales/hu.yml @@ -407,6 +407,9 @@ hu: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/it.yml b/config/locales/it.yml index deb151ae..bdf10907 100644 --- a/config/locales/it.yml +++ b/config/locales/it.yml @@ -408,6 +408,9 @@ it: # Italian strings thx 2 Matteo Arceci! label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 07140e92..2379e8ab 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -408,6 +408,9 @@ ja: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: 自分がロック中の文書 diff --git a/config/locales/ko.yml b/config/locales/ko.yml index d5d7fc6e..bdce25bf 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -407,6 +407,9 @@ ko: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: 내 잠긴 파일 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index cfbde252..6331db36 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -408,6 +408,9 @@ nl: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/pl.yml b/config/locales/pl.yml index 02da2624..bae295f6 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -408,6 +408,9 @@ pl: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 92064f39..8ffd053c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -408,6 +408,9 @@ pt-BR: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 7286aa79..a411c32c 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -408,6 +408,9 @@ ru: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/sl.yml b/config/locales/sl.yml index 61b57dd7..5b94ef2d 100644 --- a/config/locales/sl.yml +++ b/config/locales/sl.yml @@ -408,6 +408,9 @@ sl: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index f8f8d597..053caf14 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -408,6 +408,9 @@ zh-TW: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/config/locales/zh.yml b/config/locales/zh.yml index ba464862..56b5ba50 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -408,6 +408,9 @@ zh: label_add_width: Add with + dmsf_webdav_ignore_1b_file_for_authentication: Ignore 1b file sent for authentication + dmsf_webdav_ignore_1b_file_for_authentication_info: Total Commander WebDAV plugin + easy_pages: modules: dmsf_locked_documents: My locked documents diff --git a/init.rb b/init.rb index 2bb4ee07..61ddc3d4 100644 --- a/init.rb +++ b/init.rb @@ -58,7 +58,8 @@ Redmine::Plugin.register :redmine_dmsf do 'dmsf_documents_email_reply_to' => '', 'dmsf_documents_email_links_only' => nil, 'dmsf_enable_cjk_ngrams' => nil, - 'dmsf_webdav_use_project_names' => nil + 'dmsf_webdav_use_project_names' => nil, + 'dmsf_webdav_ignore_1b_file_for_authentication' => '1' } end diff --git a/lib/redmine_dmsf/webdav/dmsf_resource.rb b/lib/redmine_dmsf/webdav/dmsf_resource.rb index 0e1acc6a..86450d95 100644 --- a/lib/redmine_dmsf/webdav/dmsf_resource.rb +++ b/lib/redmine_dmsf/webdav/dmsf_resource.rb @@ -631,6 +631,12 @@ module RedmineDmsf new_revision.size = request.content_length # Bad Guess end + # Ignore 1b files sent for authentication + if Setting.plugin_redmine_dmsf['dmsf_webdav_ignore_1b_file_for_authentication'].present? && (new_revision.size == 1) + Rails.logger.info "1b file '#{basename}' sent for authentication ignored" + return NoContent + end + if new_revision.valid? && (!f.save) Rails.logger.error f.errors.full_messages.to_sentence raise InternalServerError diff --git a/test/integration/webdav/dmsf_webdav_put_test.rb b/test/integration/webdav/dmsf_webdav_put_test.rb index e1f264cd..dba30ffb 100644 --- a/test/integration/webdav/dmsf_webdav_put_test.rb +++ b/test/integration/webdav/dmsf_webdav_put_test.rb @@ -252,7 +252,6 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest assert_response :created end - original = Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] = '.dump$' put "/dmsf/webdav/#{@project1.identifier}/file3.dump", params: '1234', headers: credentials assert_response :success @@ -266,7 +265,6 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest put "/dmsf/webdav/#{@project1.identifier}/file3.dump", params: '9ABC', headers: credentials assert_response :created end - Setting.plugin_redmine_dmsf['dmsf_webdav_disable_versioning'] = original end def test_put_into_subproject @@ -299,5 +297,19 @@ class DmsfWebdavPutTest < RedmineDmsf::Test::IntegrationTest @file1.last_revision.reload assert_equal @file1.last_revision.custom_values.first.value, @cv22.value end + + def test_ignore_1b_files_on + Setting.plugin_redmine_dmsf['dmsf_webdav_ignore_1b_file_for_authentication'] = '1' + put "/dmsf/webdav/#{@project1.identifier}/1bfile.txt", params: '1', + headers: @jsmith.merge!({ content_type: :text }) + assert_response :no_content + end + + def test_ignore_1b_files_off + Setting.plugin_redmine_dmsf['dmsf_webdav_ignore_1b_file_for_authentication'] = '' + put "/dmsf/webdav/#{@project1.identifier}/1bfile.txt", params: '1', + headers: @jsmith.merge!({ content_type: :text }) + assert_response :created + end end \ No newline at end of file