Permalink
Browse files

Ensures that file and directory paths containing "." characters resol…

…ve (#205)

Ensures that the FileSystem Driver properly handles directories containing "." characters
  • Loading branch information...
jrgriffiniii authored and awead committed Apr 6, 2018
1 parent 90b6def commit 6416ce9d611a3f24d9684916edc0484e737c34d9
Showing with 5 additions and 3 deletions.
  1. +4 −1 config/routes.rb
  2. +1 −2 lib/browse_everything/driver/file_system.rb
View
@@ -3,6 +3,9 @@
BrowseEverything::Engine.routes.draw do
get 'connect', to: 'browse_everything#auth', as: 'connector_response'
match 'resolve', to: 'browse_everything#resolve', as: 'resolver', via: %i[get post]
match ':provider(/*path)', to: 'browse_everything#show', as: 'contents', via: %i[get post]
# The "format: false" argument ensures that directory paths containing period characters can be parsed
# By default, ""/dir1/dir.somedirectory.2" will be parsed as "/dir1/dir" with the format requested as "somedirectory.2"
# Please see http://guides.rubyonrails.org/routing.html#route-globbing-and-wildcard-segments
match ':provider(/*path)', to: 'browse_everything#show', as: 'contents', via: %i[get post], format: false
root to: 'browse_everything#index'
end
@@ -12,8 +12,7 @@ def validate_config
end
def contents(path = '')
relative_path = path.sub(%r{^[\/.]+}, '')
real_path = File.join(config[:home], relative_path)
real_path = File.join(config[:home], path)
entries = if File.directory?(real_path)
make_directory_entry real_path
else

0 comments on commit 6416ce9

Please sign in to comment.