Class: Bcms::WebDAV::File

Inherits:
Rack::File
  • Object
show all
Defined in:
lib/bcms_webdav/file.rb

Overview

Inherits from Rack File in order to change where paths are looked up from, since the public path of CMS files is different that actual file path.

Instance Method Summary collapse

Constructor Details

#initialize(absolute_file_path) ⇒ File

Returns a new instance of File.

Parameters:

  • absolute_file_path (String)

    Absolute path to the file on the server.



9
10
11
12
13
14
15
# File 'lib/bcms_webdav/file.rb', line 9

def initialize(absolute_file_path)
  @cms_path_to_file = absolute_file_path
  
  # Normally, files are restricted under the root of the web application.
  # Here, we set the root to blank. The cms_path_to_file is the complete path to the file.
  @root = ""
end

Instance Method Details

#call(env) ⇒ Object

As of Rack 1.4.1, we override this call to have it stuff the CMS path into the PATH_INFO



18
19
20
21
# File 'lib/bcms_webdav/file.rb', line 18

def call(env)
  env['PATH_INFO'] = @cms_path_to_file
  dup._call(env)
end