kestrel-lang
kestrel-lang copied to clipboard
File paths can't have spaces
Describe the bug A parsing error is thrown when a file path has a space in it
Details of the bug
GET process FROM file:///a/path/with/a space/in_the_name/bundle.json
Results in:
lark.exceptions.UnexpectedCharacters: No terminal matches 's' in the current parser context, .....
/a/path/with/a space/in_the_name/bundle.json`
^
Expected on of:
* WHERE
To Reproduce
Try to run GET on a file:// bundle with a space in the name
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Environment (please complete the following information):
- OS: macOS 11.6
- Python version: 3.7.7
- Python install environment:
- STIX-Shifter version: latest github develop branch.
Additional context Add any other context about the problem here.
Good catch! We don't have space in the syntax currently.
Since the command has more components after FROM, and we need to avoid confusion in case of /a/path/with/a where space/in_the_name/bundle.json. Some potential solutions:
- require escaping the space:
/a/path/with/a\ where\ space/in_the_name/bundle.json - use quotes:
"/a/path/with/a where space/in_the_name/bundle.json"
confirmed fixed in v1.4.2 with test tests/test_parser.py::test_quoted_datasource