Skip to content

Commit

Permalink
Always follow symlinks (#1883)
Browse files Browse the repository at this point in the history
  • Loading branch information
bemyak authored Jun 9, 2022
1 parent 8029cf8 commit 49b3107
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/content/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 3 additions & 1 deletion components/site/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion components/utils/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 49b3107

Please sign in to comment.