Fix reource registraton error 500 on empty or bad ptr file

This commit is contained in:
Calvo 2021-04-21 17:04:11 +02:00
parent c99e810b54
commit 888915a1c1
1 changed files with 7 additions and 2 deletions

View File

@ -1096,8 +1096,13 @@ function resource_registration_extension_main()
} }
$xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA); $xml = simplexml_load_file($_FILES['resource_upload']['tmp_name'], null, LIBXML_NOCDATA);
if ($xml === false) {
process_upload_xml($xml); ui_print_error_message(
__('Error uploading resource. Check if the selected file is a valid resource template in .ptr format')
);
} else {
process_upload_xml($xml);
}
} }