Sha256: cfefc1acef51865d09d9ed8b59548b2b4c1982c3572cdf3c6c6611a9b3538a5c

Contents?: true

Size: 1.31 KB

Versions: 4

Compression:

Stored size: 1.31 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

  put '/(:path)', :tail => true do
    if request.form_data?
      :not_implemented
    else
      webdav_post
    end
  end

  post '/(:path)', :tail => true do
    if request.form_data?
      super()
    else
      webdav_post
    end
  end

  # TODO: Implement more methods if needed
  add_route('PROPFIND', '/(:path)', :tail => true)  { :not_found }
  add_route('PROPPATCH', '/(:path)', :tail => true) { :not_implemented }
  add_route('MKCOL', '/(:path)', :tail => true)     { :not_implemented }
  add_route('COPY', '/(:path)', :tail => true)      { :not_implemented }
  add_route('MOVE', '/(:path)', :tail => true)      { :not_implemented }
  add_route('LOCK', '/(:path)', :tail => true)      { :not_implemented }
  add_route('UNLOCK', '/(:path)', :tail => true)    { :not_implemented }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
olelo-0.9.3 plugins/misc/webdav.rb
olelo-0.9.2 plugins/misc/webdav.rb
olelo-0.9.1 plugins/misc/webdav.rb
olelo-0.9.0 plugins/misc/webdav.rb