Skip to content
Snippets Groups Projects
Verified Commit 5af3aa88 authored by Damien's avatar Damien
Browse files

FEAT Check errors on jnlp

parent c60dc96e
No related branches found
No related tags found
No related merge requests found
...@@ -217,6 +217,11 @@ class JnlpController ...@@ -217,6 +217,11 @@ class JnlpController
} elseif ($data['objectType'] == 'templateModification') { } elseif ($data['objectType'] == 'templateModification') {
$docserver = DocserverModel::getCurrentDocserver(['typeId' => 'TEMPLATES', 'collId' => 'templates', 'select' => ['path_template']]); $docserver = DocserverModel::getCurrentDocserver(['typeId' => 'TEMPLATES', 'collId' => 'templates', 'select' => ['path_template']]);
$template = TemplateModel::getById(['id' => $data['objectId'], 'select' => ['template_path', 'template_file_name']]); $template = TemplateModel::getById(['id' => $data['objectId'], 'select' => ['template_path', 'template_file_name']]);
if (empty($template)) {
$xmlResponse = JnlpController::generateResponse(['type' => 'ERROR', 'data' => ['ERROR' => "Template does not exist"]]);
$response->write($xmlResponse);
return $response->withHeader('Content-Type', 'application/xml');
}
$explodeFile = explode('.', $template['template_file_name']); $explodeFile = explode('.', $template['template_file_name']);
$ext = $explodeFile[count($explodeFile) - 1]; $ext = $explodeFile[count($explodeFile) - 1];
...@@ -229,7 +234,7 @@ class JnlpController ...@@ -229,7 +234,7 @@ class JnlpController
return $response->withHeader('Content-Type', 'application/xml'); return $response->withHeader('Content-Type', 'application/xml');
} }
if (!copy($pathToCopy, $tmpPath . $newFileOnTmp)) { if (!file_exists($tmpPath . $newFileOnTmp) || !copy($pathToCopy, $tmpPath . $newFileOnTmp)) {
$xmlResponse = JnlpController::generateResponse(['type' => 'ERROR', 'data' => ['ERROR' => "Failed to copy on {$tmpPath} : {$pathToCopy}"]]); $xmlResponse = JnlpController::generateResponse(['type' => 'ERROR', 'data' => ['ERROR' => "Failed to copy on {$tmpPath} : {$pathToCopy}"]]);
$response->write($xmlResponse); $response->write($xmlResponse);
return $response->withHeader('Content-Type', 'application/xml'); return $response->withHeader('Content-Type', 'application/xml');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment