diff --git a/mxcubeweb/core/adapter/detector_adapter.py b/mxcubeweb/core/adapter/detector_adapter.py index 23ffc7b4e..9de507267 100644 --- a/mxcubeweb/core/adapter/detector_adapter.py +++ b/mxcubeweb/core/adapter/detector_adapter.py @@ -36,7 +36,7 @@ def _state_change(self, *args, **kwargs): def state(self): return self._ho.get_state().name.upper() - def display_image(self, path: str, img_num) -> dict: + def display_image(self, path: str, img_num: int) -> dict: """Notify ADXV and/or Braggy of the image to display.""" res = {"image_url": ""} diff --git a/mxcubeweb/core/server/resource_handler.py b/mxcubeweb/core/server/resource_handler.py index b6c570aba..d4490c3f0 100644 --- a/mxcubeweb/core/server/resource_handler.py +++ b/mxcubeweb/core/server/resource_handler.py @@ -28,7 +28,10 @@ def valid_object_id(object_id: str) -> bool: def validate_input_str(input_string: str) -> bool: - """Validate that input string contains only alphanumeric characters and/or dot (.). + """Validate input string. + + Ensure that input string contains only alphanumeric characters and/or + posix path characters such as dot (.), backslash (/) and dash (-). Args: input_string (str): The string to validate. @@ -36,7 +39,7 @@ def validate_input_str(input_string: str) -> bool: Returns: bool: True if the string is valid, False otherwise. """ - pattern = r"^[a-zA-Z0-9._]*$" + pattern = r"^[a-zA-Z0-9._/-]*$" return bool(re.match(pattern, input_string)) diff --git a/ui/src/actions/general.js b/ui/src/actions/general.js index ed95d8d5a..8f63db05a 100644 --- a/ui/src/actions/general.js +++ b/ui/src/actions/general.js @@ -42,7 +42,7 @@ export function displayImage(path, imgNum) { 'detector', 'detector', 'display_image', - { path, imgNum }, + { path, img_num: imgNum }, ); window.open(data.image_url, 'braggy'); };