From 3bc49ca8137684778fa4de5247c90b9ba963a528 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 15 May 2026 19:58:35 -0500 Subject: [PATCH] Fix an invalid localization string in a maketext call. Brackets in a string that are intended to be literal brackets need to be escaped. To test this earn the "Mysterious Package (with Ribbons)" achievement reward, make sure the `templates/achievements/surprise_message.txt` file does NOT exist, and then open a problem set page. With the WeBWorK-2.21 release candidate branch an exception is thrown. This particular bug apparently has been there since 2015. --- lib/WeBWorK/AchievementItems/Surprise.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/WeBWorK/AchievementItems/Surprise.pm b/lib/WeBWorK/AchievementItems/Surprise.pm index c3c4331a86..1a701928c4 100644 --- a/lib/WeBWorK/AchievementItems/Surprise.pm +++ b/lib/WeBWorK/AchievementItems/Surprise.pm @@ -26,7 +26,7 @@ sub print_form ($self, $set, $records, $c) { # The form opens the file "surprise_message.txt" in the achievements # folder and prints the contents of the file. open my $MESSAGE, '<', "$c->{ce}{courseDirs}{achievements}/surprise_message.txt" - or return $c->tag('p', $c->maketext(q{I couldn't find the file [ACHIEVEMENT_DIR]/surprise_message.txt!})); + or return $c->tag('p', $c->maketext(q{I couldn't find the file ~[ACHIEVEMENT_DIR~]/surprise_message.txt!})); local $/ = undef; my $message = <$MESSAGE>; close $MESSAGE;