474420502 / gcurl

parse curl bash to code of golang
11 stars 8 forks source link

can't parse curl without "http://" prefix #4

Open stairclimber opened 1 month ago

stairclimber commented 1 month ago

Users can use curl without "http://" prefix, and Linux curl will insert this prefix automatically, such as

curl baidu.com

and gcurl lib will panic as follows

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x5b5d0c]

=== RUN   TestLoadCurlStepsFromFile
--- FAIL: TestLoadCurlStepsFromFile (0.00s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x5b5d0c]

github.com/474420502/gcurl.ParseBash({0x700818, 0xe})
        /home/somebody/go/pkg/mod/github.com/474420502/gcurl@v0.10.0/parse_curl.go:318 +0x3ec
474420502 commented 1 month ago

@stairclimber I currently have limited support for parsing and only handle relatively simple and well-formed cases, such as standard characters copied as a URL (Bash,Cmd) command in Chrome. Some scenarios, like automatically adding "http", may not be fully supported at this time. To address this, I will need to refactor my code to handle a wider range of cases more comprehensively. My apologies for any inconvenience caused by this limitation. If there arises a strong need for this feature in the future, I will prioritize implementing it then. However, for now, this method is not supported.

lorypelli commented 3 weeks ago

@stairclimber I currently have limited support for parsing and only handle relatively simple and well-formed cases, such as standard characters copied as a URL (Bash,Cmd) command in Chrome. Some scenarios, like automatically adding "http", may not be fully supported at this time. To address this, I will need to refactor my code to handle a wider range of cases more comprehensively. My apologies for any inconvenience caused by this limitation. If there arises a strong need for this feature in the future, I will prioritize implementing it then. However, for now, this method is not supported.

Yes please, I'm still having issues and I need it to be working correctly for my app