mirror of
				https://github.com/sinatra/sinatra
				synced 2023-03-27 23:18:01 -04:00 
			
		
		
		
	rename public to public_folder, fixes #301
This commit is contained in:
		
							parent
							
								
									2d8971293a
								
							
						
					
					
						commit
						d1ab58deb3
					
				
					 14 changed files with 67 additions and 52 deletions
				
			
		| 
						 | 
				
			
			@ -210,10 +210,10 @@ Oder unter Verwendung eines negativen look ahead:
 | 
			
		|||
== Statische Dateien
 | 
			
		||||
 | 
			
		||||
Statische Dateien werden aus dem <tt>./public</tt>-Ordner ausgeliefert. Es ist
 | 
			
		||||
möglich, einen anderen Ort zu definieren, indem man die <tt>:public</tt>-Option
 | 
			
		||||
setzt:
 | 
			
		||||
möglich, einen anderen Ort zu definieren, indem man die
 | 
			
		||||
<tt>:public_folder</tt>-Option setzt:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
Zu beachten ist, dass der Ordnername public nicht Teil der URL ist. Die Datei
 | 
			
		||||
<tt>./public/css/style.css</tt> ist unter
 | 
			
		||||
| 
						 | 
				
			
			@ -1159,7 +1159,7 @@ Diese Einstellungen sind über +settings+ erreichbar:
 | 
			
		|||
                        <tt>redirect to('/foo')</tt>. Standardmäßig nicht 
 | 
			
		||||
                        aktiviert.
 | 
			
		||||
 | 
			
		||||
[public]                Das öffentliche Verzeichnis, aus dem Daten zur 
 | 
			
		||||
[public_folder]         Das öffentliche Verzeichnis, aus dem Daten zur
 | 
			
		||||
                        Verfügung gestellt werden können.
 | 
			
		||||
 | 
			
		||||
[reload_templates]      Im development-Modus aktiviert.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -209,9 +209,9 @@ O, usando un lookahead negativo:
 | 
			
		|||
 | 
			
		||||
Los archivos estáticos son servidos desde el directorio público
 | 
			
		||||
<tt>./public</tt>. Podés especificar una ubicación diferente ajustando la
 | 
			
		||||
opción <tt>:public</tt>:
 | 
			
		||||
opción <tt>:public_folder</tt>:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/estaticos'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/estaticos'
 | 
			
		||||
 | 
			
		||||
Notá que el nombre del directorio público no está incluido en la URL. Por
 | 
			
		||||
ejemplo, el archivo <tt>./public/css/style.css</tt> se accede a través de
 | 
			
		||||
| 
						 | 
				
			
			@ -1228,7 +1228,7 @@ Podés acceder a estas opciones utilizando el método <tt>settings</tt>:
 | 
			
		|||
                       que <tt>redirect to('/foo')</tt>.  Se encuentra
 | 
			
		||||
                       deshabilitada por defecto.
 | 
			
		||||
 | 
			
		||||
[public]               directorio desde donde se sirven los archivos públicos.
 | 
			
		||||
[public_folder]        directorio desde donde se sirven los archivos públicos.
 | 
			
		||||
 | 
			
		||||
[reload_templates]     define si se recargan las plantillas entre peticiones.
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -209,9 +209,9 @@ Ou bien en utilisant la forme négative :
 | 
			
		|||
 | 
			
		||||
Par défaut, le dossier <tt>./public</tt> est utilisé pour servir les fichiers
 | 
			
		||||
statiques. Vous pouvez changer ce dossier pour un autre nom grâce au paramètre
 | 
			
		||||
<tt>:public</tt> :
 | 
			
		||||
<tt>:public_folder</tt> :
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/statique'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/statique'
 | 
			
		||||
 | 
			
		||||
Notez que le nom du dossier public n'est pas inclus dans l'URL. Un fichier
 | 
			
		||||
sous <tt>./public/css/style.css</tt> est appelé avec l'URL : <tt>http://exemple.com/css/style.css</tt>.
 | 
			
		||||
| 
						 | 
				
			
			@ -1243,7 +1243,7 @@ Vous pouvez accéder à ces paramètres via <tt>settings</tt> :
 | 
			
		|||
                      comportera comme <tt>redirect to('/foo')</tt>.
 | 
			
		||||
                      Désactivé par défaut.
 | 
			
		||||
 | 
			
		||||
[public]              dossier duquel les fichiers publics sont servis
 | 
			
		||||
[public_folder]       dossier duquel les fichiers publics sont servis
 | 
			
		||||
 | 
			
		||||
[reload_templates]    si oui ou non les templates doivent être rechargés
 | 
			
		||||
                      entre les requêtes. Activé en mode développement.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -99,9 +99,9 @@ tervezhetők, így például az user agent karakterláncot alapul véve:
 | 
			
		|||
 | 
			
		||||
A statikus fájlok kiszolgálása a <tt>./public</tt> könyvtárból
 | 
			
		||||
történik, de természetesen más könyvtárat is megadhatsz erre a célra,
 | 
			
		||||
mégpedig a <tt>:public</tt> kapcsoló beállításával:
 | 
			
		||||
mégpedig a <tt>:public_folder</tt> kapcsoló beállításával:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
Fontos mgejegyezni, hogy a nyilvános könyvtár neve nem szerepel az URL-ben.
 | 
			
		||||
A <tt>./public/css/style.css</tt> fájl az
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -153,9 +153,9 @@ Rackレスポンス、Rackボディオブジェクト、HTTPステータスコ
 | 
			
		|||
== 静的ファイル
 | 
			
		||||
 | 
			
		||||
静的ファイルは<tt>./public</tt>ディレクトリから配信されます。
 | 
			
		||||
<tt>:public</tt>オプションを指定することで別の場所を指定することができます。
 | 
			
		||||
<tt>:public_folder</tt>オプションを指定することで別の場所を指定することができます。
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
注意: この静的ファイル用のディレクトリ名はURL中に含まれません。
 | 
			
		||||
例えば、<tt>./public/css/style.css</tt>は<tt>http://example.com/css/style.css</tt>でアクセスできます。
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,9 +95,9 @@ Rotas podem incluir uma variedade de condições correspondes, tal como o agente
 | 
			
		|||
== Arquivos estáticos
 | 
			
		||||
 | 
			
		||||
Arquivos estáticos são disponibilizados a partir do diretório <tt>./public</tt>. Você pode especificar
 | 
			
		||||
um local diferente pela opção <tt>:public</tt>
 | 
			
		||||
um local diferente pela opção <tt>:public_folder</tt>
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/estatico'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/estatico'
 | 
			
		||||
 | 
			
		||||
Note que o nome do diretório público não é incluido na URL. Um arquivo
 | 
			
		||||
<tt>./public/css/style.css</tt> é disponibilizado como
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,9 +95,9 @@ Rotas podem incluir uma variedade de condições correspondentes, por exemplo, o
 | 
			
		|||
== Arquivos estáticos
 | 
			
		||||
 | 
			
		||||
Arquivos estáticos são disponibilizados a partir do directório <tt>./public</tt>. Você pode especificar
 | 
			
		||||
um local diferente através da opção <tt>:public</tt>
 | 
			
		||||
um local diferente através da opção <tt>:public_folder</tt>
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/estatico'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/estatico'
 | 
			
		||||
 | 
			
		||||
Note que o nome do directório público não é incluido no URL. Um arquivo
 | 
			
		||||
<tt>./public/css/style.css</tt> é disponibilizado como
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -208,9 +208,9 @@ Or, using negative look ahead:
 | 
			
		|||
== Static Files
 | 
			
		||||
 | 
			
		||||
Static files are served from the <tt>./public</tt> directory. You can specify
 | 
			
		||||
a different location by setting the <tt>:public</tt> option:
 | 
			
		||||
a different location by setting the <tt>:public_folder</tt> option:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
Note that the public directory name is not included in the URL. A file
 | 
			
		||||
<tt>./public/css/style.css</tt> is made available as
 | 
			
		||||
| 
						 | 
				
			
			@ -1184,7 +1184,7 @@ You can access those options via <tt>settings</tt>:
 | 
			
		|||
                       <tt>redirect '/foo'</tt> would behave like
 | 
			
		||||
                       <tt>redirect to('/foo')</tt>. Disabled per default.
 | 
			
		||||
 | 
			
		||||
[public]               folder public files are served from
 | 
			
		||||
[public_folder]        folder public files are served from
 | 
			
		||||
 | 
			
		||||
[reload_templates]     whether or not to reload templates between requests.
 | 
			
		||||
                       Enabled in development mode.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -206,9 +206,9 @@ Thin - это более производительный и функциона
 | 
			
		|||
== Статические файлы
 | 
			
		||||
 | 
			
		||||
Статические файлы отдаются из <tt>./public</tt> директории. Вы можете указать другое место,
 | 
			
		||||
указав его через опцию <tt>:public</tt>:
 | 
			
		||||
указав его через опцию <tt>:public_folder</tt>:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
Учтите, что имя директории со статическими файлами не включено в URL. Например, файл
 | 
			
		||||
<tt>./public/css/style.css</tt> будет доступен как
 | 
			
		||||
| 
						 | 
				
			
			@ -1182,7 +1182,7 @@ Thin - это более производительный и функциона
 | 
			
		|||
                       если не задан абсолютный путь. Таким образом,  <tt>redirect '/foo'</tt>
 | 
			
		||||
                       будет вести себя как <tt>redirect to('/foo')</tt>. Отключено по умолчанию.
 | 
			
		||||
 | 
			
		||||
[public]               директория, откуда будут раздаваться статические файлы.
 | 
			
		||||
[public_folder]        директория, откуда будут раздаваться статические файлы.
 | 
			
		||||
 | 
			
		||||
[reload_templates]     перезагружать или нет шаблоны на каждый запрос.
 | 
			
		||||
                       Включено в режиме разработки.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -194,10 +194,10 @@ Rack body对象或者HTTP状态码:
 | 
			
		|||
 | 
			
		||||
== 静态文件
 | 
			
		||||
 | 
			
		||||
静态文件是从 <tt>./public</tt> 目录提供服务。你可以通过设置<tt>:public</tt>
 | 
			
		||||
静态文件是从 <tt>./public_folder</tt> 目录提供服务。你可以通过设置<tt>:public</tt>
 | 
			
		||||
选项设定一个不同的位置:
 | 
			
		||||
 | 
			
		||||
  set :public, File.dirname(__FILE__) + '/static'
 | 
			
		||||
  set :public_folder, File.dirname(__FILE__) + '/static'
 | 
			
		||||
 | 
			
		||||
请注意public目录名并没有被包含在URL之中。文件
 | 
			
		||||
<tt>./public/css/style.css</tt>是通过
 | 
			
		||||
| 
						 | 
				
			
			@ -1268,7 +1268,7 @@ Sinatra会自动处理range请求。
 | 
			
		|||
                      <tt>redirect '/foo'</tt> 会和
 | 
			
		||||
                      <tt>redirect to('/foo')</tt>起相同作用。默认禁用。
 | 
			
		||||
 | 
			
		||||
[public]              public文件夹的位置。
 | 
			
		||||
[public_folder]      public文件夹的位置。
 | 
			
		||||
 | 
			
		||||
[reload_templates]    是否每个请求都重新载入模板。
 | 
			
		||||
                      在development mode和 Ruby 1.8.6 中被企业(用来
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -408,7 +408,7 @@ module Sinatra
 | 
			
		|||
 | 
			
		||||
    def erubis(template, options={}, locals={})
 | 
			
		||||
      warn "Sinatra::Templates#erubis is deprecated and will be removed, use #erb instead.\n" \
 | 
			
		||||
        "If you have Erubis installed, it will be used automatically.\n\tfrom #{caller.first}"
 | 
			
		||||
        "If you have Erubis installed, it will be used automatically."
 | 
			
		||||
      render :erubis, template, options, locals
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -623,7 +623,7 @@ module Sinatra
 | 
			
		|||
 | 
			
		||||
    def options
 | 
			
		||||
      warn "Sinatra::Base#options is deprecated and will be removed, " \
 | 
			
		||||
        "use #settings instead.\n\tfrom #{caller.first}"
 | 
			
		||||
        "use #settings instead."
 | 
			
		||||
      settings
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -735,7 +735,7 @@ module Sinatra
 | 
			
		|||
    # Attempt to serve static files from public directory. Throws :halt when
 | 
			
		||||
    # a matching file is found, returns nil otherwise.
 | 
			
		||||
    def static!
 | 
			
		||||
      return if (public_dir = settings.public).nil?
 | 
			
		||||
      return if (public_dir = settings.public_folder).nil?
 | 
			
		||||
      public_dir = File.expand_path(public_dir)
 | 
			
		||||
 | 
			
		||||
      path = File.expand_path(public_dir + unescape(request.path_info))
 | 
			
		||||
| 
						 | 
				
			
			@ -1011,6 +1011,11 @@ module Sinatra
 | 
			
		|||
        @conditions << generate_method(name, &block)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      def public=(value)
 | 
			
		||||
        warn ":public is no longer used to avoid overloading Module#public, use :public_folder instead"
 | 
			
		||||
        set(:public_folder, value)
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
   private
 | 
			
		||||
      # Condition for matching host name. Parameter might be String or Regexp.
 | 
			
		||||
      def host_name(pattern)
 | 
			
		||||
| 
						 | 
				
			
			@ -1291,16 +1296,26 @@ module Sinatra
 | 
			
		|||
      # Like Kernel#caller but excluding certain magic entries and without
 | 
			
		||||
      # line / method information; the resulting array contains filenames only.
 | 
			
		||||
      def caller_files
 | 
			
		||||
        caller_locations.
 | 
			
		||||
          map { |file,line| file }
 | 
			
		||||
        cleaned_caller(1).flatten
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Like caller_files, but containing Arrays rather than strings with the
 | 
			
		||||
      # first element being the file, and the second being the line.
 | 
			
		||||
      def caller_locations
 | 
			
		||||
        cleaned_caller 2
 | 
			
		||||
      end
 | 
			
		||||
    
 | 
			
		||||
    private
 | 
			
		||||
      # used for deprecation warnings
 | 
			
		||||
      def warn(message)
 | 
			
		||||
        super message + "\n\tfrom #{cleaned_caller.first.join(':')}"
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      # Like Kernel#caller but excluding certain magic entries
 | 
			
		||||
      def cleaned_caller(keep = 3)
 | 
			
		||||
        caller(1).
 | 
			
		||||
          map    { |line| line.split(/:(?=\d|in )/)[0,2] }.
 | 
			
		||||
          reject { |file,line| CALLERS_TO_IGNORE.any? { |pattern| file =~ pattern } }
 | 
			
		||||
          map    { |line| line.split(/:(?=\d|in )/, 3)[0,keep] }.
 | 
			
		||||
          reject { |file, *_| CALLERS_TO_IGNORE.any? { |pattern| file =~ pattern } }
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1370,8 +1385,8 @@ module Sinatra
 | 
			
		|||
    set :reload_templates, Proc.new { development? }
 | 
			
		||||
    set :lock, false
 | 
			
		||||
 | 
			
		||||
    set :public, Proc.new { root && File.join(root, 'public') }
 | 
			
		||||
    set :static, Proc.new { public && File.exist?(public) }
 | 
			
		||||
    set :public_folder, Proc.new { root && File.join(root, 'public') }
 | 
			
		||||
    set :static, Proc.new { public_folder && File.exist?(public_folder) }
 | 
			
		||||
    set :static_cache_control, false
 | 
			
		||||
 | 
			
		||||
    error ::Exception do
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -114,7 +114,7 @@ class BeforeFilterTest < Test::Unit::TestCase
 | 
			
		|||
    mock_app {
 | 
			
		||||
      before { ran_filter = true }
 | 
			
		||||
      set :static, true
 | 
			
		||||
      set :public, File.dirname(__FILE__)
 | 
			
		||||
      set :public_folder, File.dirname(__FILE__)
 | 
			
		||||
    }
 | 
			
		||||
    get "/#{File.basename(__FILE__)}"
 | 
			
		||||
    assert ok?
 | 
			
		||||
| 
						 | 
				
			
			@ -237,7 +237,7 @@ class AfterFilterTest < Test::Unit::TestCase
 | 
			
		|||
    mock_app {
 | 
			
		||||
      after { ran_filter = true }
 | 
			
		||||
      set :static, true
 | 
			
		||||
      set :public, File.dirname(__FILE__)
 | 
			
		||||
      set :public_folder, File.dirname(__FILE__)
 | 
			
		||||
    }
 | 
			
		||||
    get "/#{File.basename(__FILE__)}"
 | 
			
		||||
    assert ok?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -359,13 +359,13 @@ class SettingsTest < Test::Unit::TestCase
 | 
			
		|||
      assert ! @base.static?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'is enabled on Base when public is set and exists' do
 | 
			
		||||
    it 'is enabled on Base when public_folder is set and exists' do
 | 
			
		||||
      @base.set :environment, :development
 | 
			
		||||
      @base.set :public, File.dirname(__FILE__)
 | 
			
		||||
      @base.set :public_folder, File.dirname(__FILE__)
 | 
			
		||||
      assert @base.static?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'is enabled on Base when root is set and root/public exists' do
 | 
			
		||||
    it 'is enabled on Base when root is set and root/public_folder exists' do
 | 
			
		||||
      @base.set :environment, :development
 | 
			
		||||
      @base.set :root, File.dirname(__FILE__)
 | 
			
		||||
      assert @base.static?
 | 
			
		||||
| 
						 | 
				
			
			@ -375,13 +375,13 @@ class SettingsTest < Test::Unit::TestCase
 | 
			
		|||
      assert ! @application.static?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'is enabled on Application when public is set and exists' do
 | 
			
		||||
    it 'is enabled on Application when public_folder is set and exists' do
 | 
			
		||||
      @application.set :environment, :development
 | 
			
		||||
      @application.set :public, File.dirname(__FILE__)
 | 
			
		||||
      @application.set :public_folder, File.dirname(__FILE__)
 | 
			
		||||
      assert @application.static?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'is enabled on Application when root is set and root/public exists' do
 | 
			
		||||
    it 'is enabled on Application when root is set and root/public_folder exists' do
 | 
			
		||||
      @application.set :environment, :development
 | 
			
		||||
      @application.set :root, File.dirname(__FILE__)
 | 
			
		||||
      assert @application.static?
 | 
			
		||||
| 
						 | 
				
			
			@ -469,18 +469,18 @@ class SettingsTest < Test::Unit::TestCase
 | 
			
		|||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  describe 'public' do
 | 
			
		||||
  describe 'public_folder' do
 | 
			
		||||
    it 'is nil if root is not set' do
 | 
			
		||||
      assert @base.public.nil?
 | 
			
		||||
      assert @application.public.nil?
 | 
			
		||||
      assert @base.public_folder.nil?
 | 
			
		||||
      assert @application.public_folder.nil?
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    it 'is set to root joined with public/' do
 | 
			
		||||
      @base.root = File.dirname(__FILE__)
 | 
			
		||||
      assert_equal File.dirname(__FILE__) + "/public", @base.public
 | 
			
		||||
      assert_equal File.dirname(__FILE__) + "/public", @base.public_folder
 | 
			
		||||
 | 
			
		||||
      @application.root = File.dirname(__FILE__)
 | 
			
		||||
      assert_equal File.dirname(__FILE__) + "/public", @application.public
 | 
			
		||||
      assert_equal File.dirname(__FILE__) + "/public", @application.public_folder
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -4,7 +4,7 @@ class StaticTest < Test::Unit::TestCase
 | 
			
		|||
  setup do
 | 
			
		||||
    mock_app {
 | 
			
		||||
      set :static, true
 | 
			
		||||
      set :public, File.dirname(__FILE__)
 | 
			
		||||
      set :public_folder, File.dirname(__FILE__)
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -66,7 +66,7 @@ class StaticTest < Test::Unit::TestCase
 | 
			
		|||
  end
 | 
			
		||||
 | 
			
		||||
  it 'passes to the next handler when the public option is nil' do
 | 
			
		||||
    @app.set :public, nil
 | 
			
		||||
    @app.set :public_folder, nil
 | 
			
		||||
    get "/#{File.basename(__FILE__)}"
 | 
			
		||||
    assert not_found?
 | 
			
		||||
  end
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +85,7 @@ class StaticTest < Test::Unit::TestCase
 | 
			
		|||
  it '404s when .. path traverses outside of public directory' do
 | 
			
		||||
    mock_app {
 | 
			
		||||
      set :static, true
 | 
			
		||||
      set :public, File.dirname(__FILE__) + '/data'
 | 
			
		||||
      set :public_folder, File.dirname(__FILE__) + '/data'
 | 
			
		||||
    }
 | 
			
		||||
    get "/../#{File.basename(__FILE__)}"
 | 
			
		||||
    assert not_found?
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue