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

Use FileUtils#remove_entry_secure in StaticFile#write #9355

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

edward
Copy link

@edward edward commented Apr 24, 2023

Sometimes the dest_path in Jekyll::StaticFile#write is a directory. When this happens, FileUtils.rm(dest_path) will raise an exception.

Using FileUtils.remove_entry_secure(dest_path) instead will not raise an exception and remove (aka “unlink”) file system entries if the file dest_path points to is a directory or a non-directory file.

This is a 🐛 bug fix.

Sometimes the `dest_path` in Jekyll::StaticFile#write is a directory. When this happens, `FileUtils.rm(dest_path)` will raise an exception.

Using `FileUtils.remove_entry_secure(dest_path)` instead will not raise an exception and remove (aka “unlink”) file system entries if the file `dest_path` points to is a directory or a non-directory file.
@parkr
Copy link
Member

parkr commented Aug 13, 2023

Why would a static file be a directory?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants