Skip to content

Commit

Permalink
Merge pull request openwebwork#2574 from drgrice1/render-problem-non-…
Browse files Browse the repository at this point in the history
…empty-filenames

Fix rendering static images when checking answers in the PG problem editor.
  • Loading branch information
pstaabp authored Nov 12, 2024
2 parents 5289d8b + 1f2fd3a commit 0448efb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/WebworkWebservice/RenderProblem.pm
Original file line number Diff line number Diff line change
Expand Up @@ -189,13 +189,13 @@ async sub renderProblem {
my $r_problem_source;
if ($rh->{problemSource}) {
$r_problem_source = \(decode_utf8_base64($rh->{problemSource}) =~ tr/\r/\n/r);
$problemRecord->source_file(defined $rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
$problemRecord->source_file($rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
} elsif ($rh->{rawProblemSource}) {
$r_problem_source = \$rh->{rawProblemSource};
$problemRecord->source_file(defined $rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
$problemRecord->source_file($rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
} elsif ($rh->{uriEncodedProblemSource}) {
$r_problem_source = \(url_unescape($rh->{uriEncodedProblemSource}));
$problemRecord->source_file(defined $rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
$problemRecord->source_file($rh->{fileName} ? $rh->{fileName} : $rh->{sourceFilePath});
} elsif (defined $rh->{sourceFilePath} && $rh->{sourceFilePath} =~ /\S/) {
$problemRecord->source_file($rh->{sourceFilePath});
$r_problem_source = \(readFile($ce->{courseDirs}{templates} . '/' . $rh->{sourceFilePath}));
Expand Down

0 comments on commit 0448efb

Please sign in to comment.