Skip to content

Add filetype protections

Adds functions isValidJSON() and getFiletype().

These functions are then used to raise an error in the event that the user attempts to upload an incorrectly formatted file, or a file of the wrong filetype e.g. attempting to upload an HLT menu to the L1 menu table.

The code is also reorganised so that all checks for validity are performed before any uploads are attempted. For example, the insertMenu.py process is now: L1 validity check->HLT validity check->JO validity check->L1 upload->HLT upload->JO upload as opposed to: L1 validity check->L1 upload->HLT validity check->HLT upload->JO validity check->JO upload This avoids the situation where e.g. the L1 menu would be valid but the HLT menu would be invalid, resulting in the L1 menu being uploaded successfully, then an error being raised for the HLT upload, resulting in the L1 menu being orphaned in the L1 menu table without an SMK being created.

Also includes minor formatting changes.

WIP until MR !11 (merged) is merged.

cc: @mark

Edited by Joerg Stelzer

Merge request reports