kestrel-lang icon indicating copy to clipboard operation
kestrel-lang copied to clipboard

File paths can't have spaces

Open imolloy opened this issue 3 years ago • 1 comments

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.

imolloy avatar Jan 06 '22 15:01 imolloy

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:

  1. require escaping the space: /a/path/with/a\ where\ space/in_the_name/bundle.json
  2. use quotes: "/a/path/with/a where space/in_the_name/bundle.json"

subbyte avatar Jan 06 '22 22:01 subbyte

confirmed fixed in v1.4.2 with test tests/test_parser.py::test_quoted_datasource

subbyte avatar Oct 18 '22 13:10 subbyte