Skip to content

Commit 495e8ac

Browse files
authored
Merge pull request #2793 from drgrice1/directory-integrity-realpath-fix
Fix a `realpath` failure when resolving course symlinks.
2 parents 7656ccf + 8d7f3d7 commit 495e8ac

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/WeBWorK/Utils/CourseDirectoryIntegrityCheck.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ sub checkCourseLinks {
7474
# All links should actually be links, and should have the correct target. Note that the link target may also be
7575
# a link, and so the realpath of the configured link target and realpath of the course link path must be
7676
# compared to check that the link target is correct.
77-
my $good = -l $path && path($path)->realpath eq path($target)->realpath;
77+
my $good = -l $path && (eval { path($path)->realpath } // '') eq path($target)->realpath;
7878

7979
$links_ok = 0 if !$good;
8080
push @results, [ $link, $target, $path, $good ];
@@ -213,7 +213,7 @@ sub updateCourseLinks {
213213
my $targetIsCorrect = 0;
214214

215215
if (-l $path) {
216-
$targetIsCorrect = path($path)->realpath eq path($target)->realpath;
216+
$targetIsCorrect = (eval { path($path)->realpath } // '') eq path($target)->realpath;
217217
next if $targetIsCorrect;
218218
}
219219

0 commit comments

Comments
 (0)