| … | |
… | |
| 475 | die "tempFilePath is unsafe!" unless path_is_subdir($tempFilePath, $ce->{courseDirs}->{templates}, 1); # 1==path can be relative to dir |
475 | die "tempFilePath is unsafe!" unless path_is_subdir($tempFilePath, $ce->{courseDirs}->{templates}, 1); # 1==path can be relative to dir |
| 476 | eval { $problemContents = WeBWorK::Utils::readFile($tempFilePath) }; |
476 | eval { $problemContents = WeBWorK::Utils::readFile($tempFilePath) }; |
| 477 | $problemContents = $@ if $@; |
477 | $problemContents = $@ if $@; |
| 478 | $inputFilePath = $tempFilePath; |
478 | $inputFilePath = $tempFilePath; |
| 479 | } elsif (-r $editFilePath and not -d $editFilePath) { |
479 | } elsif (-r $editFilePath and not -d $editFilePath) { |
| 480 | die "editFilePath is unsafe!" unless path_is_subdir($editFilePath, $ce->{courseDirs}->{templates}, 1); # 1==path can be relative to dir |
480 | die "editFilePath is unsafe!" unless path_is_subdir($editFilePath, $ce->{courseDirs}->{templates}, 1) # 1==path can be relative to dir |
|
|
481 | || $editFilePath eq $ce->{webworkFiles}{screenSnippets}{setHeader} |
|
|
482 | || $editFilePath eq $ce->{webworkFiles}{hardcopySnippets}{hardcopyHeader}; |
| 481 | eval { $problemContents = WeBWorK::Utils::readFile($editFilePath) }; |
483 | eval { $problemContents = WeBWorK::Utils::readFile($editFilePath) }; |
| 482 | $problemContents = $@ if $@; |
484 | $problemContents = $@ if $@; |
| 483 | $inputFilePath = $editFilePath; |
485 | $inputFilePath = $editFilePath; |
| 484 | } else { # file not existing is not an error |
486 | } else { # file not existing is not an error |
| 485 | #warn "No file exists"; |
487 | #warn "No file exists"; |