Sha256: 1a99a6dd0e00bc2a932532fa35790c2c8f6b7e803fcb347b1a39efbcf5ffc414
Contents?: true
Size: 1.45 KB
Versions: 6
Compression:
Stored size: 1.45 KB
Contents
description 'Simple webdav interface to the wiki files' class ::Olelo::Application def webdav_post Page.transaction do page = request.put? ? Page.find!(params[:path]) : Page.new(params[:path]) raise :reserved_path.t if self.class.reserved_path?(page.path) page.content = request.body page.save Page.commit(:page_uploaded.t(page: page.title)) :created end rescue NotFound => ex Olelo.logger.error ex :not_found rescue Exception => ex Olelo.logger.error ex :bad_request end get '/webdav(/(:path))' do begin page = Page.find!(params[:path]) cache_control etag: page.etag response['Content-Type'] = page.mime.to_s page.content rescue NotFound => ex Olelo.logger.error ex :not_found rescue Exception => ex Olelo.logger.error ex :bad_request end end put('/webdav(/(:path))') { webdav_post } post('/webdav(/(:path))') { webdav_post } # TODO: Implement more methods if needed add_route('PROPFIND', '/webdav(/(:path))') { :not_found } add_route('PROPPATCH', '/webdav(/(:path))') { :not_implemented } add_route('MKCOL', '/webdav(/(:path))') { :not_implemented } add_route('COPY', '/webdav(/(:path))') { :not_implemented } add_route('MOVE', '/webdav(/(:path))') { :not_implemented } add_route('LOCK', '/webdav(/(:path))') { :not_implemented } add_route('UNLOCK', '/webdav(/(:path))') { :not_implemented } end
Version data entries
6 entries across 6 versions & 1 rubygems