Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #34 -- Don't remove files with a hidden component #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion spec/baked_file_system_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe BakedFileSystem do

it "get correct file attributes" do
baked_file = Storage.get("images/sidekiq.png")
baked_file.size.should eq(52949)
baked_file.size.should eq(52947)
baked_file.compressed_size.should be_close 47883, 40

baked_file = Storage.get("/lorem.txt")
Expand Down
Binary file modified spec/storage/images/sidekiq.png
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: What's happening with this file?

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions src/loader/loader.cr
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
raise Error.new "path does not exist: #{root_path}"
elsif !File.directory?(root_path)
raise Error.new "path is not a directory: #{root_path}"
elsif !File.readable?(root_path)

Check warning on line 15 in src/loader/loader.cr

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, latest)

Deprecated File.readable?. Use `File::Info.readable?` instead

Check warning on line 15 in src/loader/loader.cr

View workflow job for this annotation

GitHub Actions / Test (ubuntu-latest, nightly)

Deprecated File.readable?. Use `File::Info.readable?` instead

Check warning on line 15 in src/loader/loader.cr

View workflow job for this annotation

GitHub Actions / Test (macos-latest)

Deprecated File.readable?. Use `File::Info.readable?` instead

Check warning on line 15 in src/loader/loader.cr

View workflow job for this annotation

GitHub Actions / Test (windows-latest)

Deprecated File.readable?. Use `File::Info.readable?` instead
raise Error.new "path is not readable: #{root_path}"
end

Expand All @@ -21,8 +21,8 @@
result = [] of String

files = Dir.glob(Path[root_path].to_posix.join("**", "*"))
# Reject hidden entities and directories
.reject { |path| File.directory?(path) || !(path =~ /(\/\..+)/).nil? }
# Reject directories
.reject { |path| File.directory?(path) }

files.each do |path|
io << "bake_file BakedFileSystem::BakedFile.new(\n"
Expand Down
Loading