Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 370f2b7

Browse files
committedMar 18, 2025·
Properly quote file names in the regexp used to extract backup times.
If a backup filename contains certain special characters, then an exception is thrown when used in the regular expression to extract the time from the backup filename. To protect against this the metaquoting escape sequence (`\Q...\E`) is needed. This fixes issue #2680.
1 parent ef05f1a commit 370f2b7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed
 

‎lib/WeBWorK/ContentGenerator/Instructor/PGProblemEditor.pm

+1-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ sub getBackupTimes ($c) {
620620
my $backupBasePath = $c->{backupBasePath};
621621
my @files = glob(qq("$backupBasePath*"));
622622
return unless @files;
623-
return reverse(map { $_ =~ s/$backupBasePath//r } @files);
623+
return reverse(map { $_ =~ s/\Q$backupBasePath\E//r } @files);
624624
}
625625

626626
sub backupFile ($c, $outputFilePath) {

0 commit comments

Comments
 (0)
Please sign in to comment.