Skip to content

Commit 359a501

Browse files
committed
recognize hidden files
1 parent d730c65 commit 359a501

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

webfs.cr

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ server = HTTP::Server.new do |context|
9999
response.headers["Content-Type"] = "application/zip"
100100
response.headers["Content-Disposition"] = "attachment; filename=\"#{download_filename}\""
101101
Compress::Zip::Writer.open(response.output) do |zip|
102-
Dir.glob("#{request_path_absolute}/**/*").each do |target_path|
102+
Dir.glob("#{request_path_absolute}/**/*", match_hidden: true).each do |target_path|
103103
next if File.directory? target_path
104104
next unless File.readable? target_path
105105
relative_path = target_path.relative_to request_path_absolute
@@ -115,8 +115,7 @@ server = HTTP::Server.new do |context|
115115
root + elements[0..i].join("/")
116116
end
117117
# collect entries
118-
entries = Dir["#{request_path_absolute}/*"].map{|entry| entry}
119-
entries = Dir["#{request_path_absolute}/*"]
118+
entries = Dir.glob("#{request_path_absolute}/*", match_hidden: true)
120119
dirs = entries.select{|entry| File.directory? entry}.sort
121120
files = (entries - dirs).sort
122121
sorted_entries = dirs + files

0 commit comments

Comments
 (0)