update dav4rack, tempblock some methods until we can cover them properly

This commit is contained in:
Kyle Drake 2019-09-03 00:16:41 -07:00
parent 71534eda41
commit 69ba17d081
3 changed files with 28 additions and 15 deletions

View file

@ -17,7 +17,7 @@ gem 'stripe', '4.2.0' #, source: 'https://code.stripe.com/'
gem 'terrapin' gem 'terrapin'
gem 'zipruby' gem 'zipruby'
gem 'sass', require: nil gem 'sass', require: nil
gem 'dav4rack', git: 'https://github.com/planio-gmbh/dav4rack.git', branch: 'redmine-storage' gem 'dav4rack', git: 'https://github.com/neocities/dav4rack.git', ref: '3ecde122a0b8bcc1d85581dc85ef3a7120b6a8f0'
gem 'filesize' gem 'filesize'
gem 'thread' gem 'thread'
gem 'rack-cache' gem 'rack-cache'

View file

@ -1,12 +1,13 @@
GIT GIT
remote: https://github.com/planio-gmbh/dav4rack.git remote: https://github.com/neocities/dav4rack.git
revision: ec491dccab4bcfa846bb4616c7177fb09819981c revision: 3ecde122a0b8bcc1d85581dc85ef3a7120b6a8f0
branch: redmine-storage ref: 3ecde122a0b8bcc1d85581dc85ef3a7120b6a8f0
specs: specs:
dav4rack (0.3.0) dav4rack (1.1.0)
nokogiri (>= 1.4.2) addressable (>= 2.5.0)
nokogiri (>= 1.6.0)
ox (>= 2.1.0) ox (>= 2.1.0)
rack (>= 1.1.0) rack (>= 1.6)
uuidtools (~> 2.1.1) uuidtools (~> 2.1.1)
GEM GEM
@ -387,4 +388,4 @@ DEPENDENCIES
zipruby zipruby
BUNDLED WITH BUNDLED WITH
2.0.1 2.0.2

View file

@ -43,21 +43,33 @@ map '/webdav' do
end end
if env['REQUEST_METHOD'] == 'MOVE' if env['REQUEST_METHOD'] == 'MOVE'
tmpfile = Tempfile.new 'moved_file'
tmpfile.close
destination = env['HTTP_DESTINATION'].match(/^.+\/webdav(.+)$/i).captures.first destination = env['HTTP_DESTINATION'].match(/^.+\/webdav(.+)$/i).captures.first
FileUtils.cp site.files_path(env['PATH_INFO']), tmpfile.path env['PATH_INFO'] = env['PATH_INFO'][1..env['PATH_INFO'].length] if env['PATH_INFO'][0] == '/'
DB.transaction do site_file = @site.site_files.select {|s| s.path == env['PATH_INFO']}.first
@site.store_files [{filename: destination, tempfile: tmpfile}] res = site_file.rename destination
@site.delete_file env['PATH_INFO']
end
return [201, {}, ['']] return [201, {}, ['']]
end end
if env['REQUEST_METHOD'] == 'COPY'
return [501, {}, ['']]
end
if env['REQUEST_METHOD'] == 'LOCK'
return [501, {}, ['']]
end
if env['REQUEST_METHOD'] == 'UNLOCK'
return [501, {}, ['']]
end
if env['REQUEST_METHOD'] == 'PROPPATCH'
return [501, {}, ['']]
end
if env['REQUEST_METHOD'] == 'DELETE' if env['REQUEST_METHOD'] == 'DELETE'
@site.delete_file env['PATH_INFO'] @site.delete_file env['PATH_INFO']
return [201, {}, ['']] return [201, {}, ['']]