Always follow symlinks (#1883)

This commit is contained in:
bemyak 2022-06-09 22:47:52 +03:00 committed by GitHub
parent 8029cf891a
commit 49b310764a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View file

@ -27,7 +27,7 @@ pub fn has_anchor(headings: &[Heading], anchor: &str) -> bool {
pub fn find_related_assets(path: &Path, config: &Config, recursive: bool) -> Vec<PathBuf> {
let mut assets = vec![];
let mut builder = WalkDir::new(path);
let mut builder = WalkDir::new(path).follow_links(true);
if !recursive {
builder = builder.max_depth(1);
}

View file

@ -170,7 +170,8 @@ impl Site {
// not the most elegant loop, but this is necessary to use skip_current_dir
// which we can only decide to use after we've deserialised the section
// so it's kinda necessecary
let mut dir_walker = WalkDir::new(format!("{}/{}", base_path, "content/")).into_iter();
let mut dir_walker =
WalkDir::new(format!("{}/{}", base_path, "content/")).follow_links(true).into_iter();
let mut allowed_index_filenames: Vec<_> = self
.config
.other_languages()
@ -220,6 +221,7 @@ impl Site {
// index files for all languages and process them simultaniously
// before any of the pages
let index_files = WalkDir::new(&path)
.follow_links(true)
.max_depth(1)
.into_iter()
.filter_map(|e| match e {

View file

@ -111,7 +111,9 @@ pub fn copy_file_if_needed(src: &Path, dest: &Path, hard_link: bool) -> Result<(
}
pub fn copy_directory(src: &Path, dest: &Path, hard_link: bool) -> Result<()> {
for entry in WalkDir::new(src).into_iter().filter_map(std::result::Result::ok) {
for entry in
WalkDir::new(src).follow_links(true).into_iter().filter_map(std::result::Result::ok)
{
let relative_path = entry.path().strip_prefix(src).unwrap();
let target_path = dest.join(relative_path);