olsh / curl-to-csharp

curl to C# converter
https://curl.olsh.me
MIT License
223 stars 41 forks source link

"^" Problem #131

Open ebubekirbastama opened 1 year ago

ebubekirbastama commented 1 year ago

It adds "^" when a curl copy request is received from the Web Browser. It would be nice if you add code to delete this character :)

olsh commented 1 year ago

Hi @ebubekirbastama 🤝

Hm, I don't quite understand the issue. Could you please provide more information?

ebubekirbastama commented 1 year ago

Of course. For example, I opened "https://curl.olsh.me/" in the Google browser, clicked on "inspect," navigated to the Network section, and copied the cURL command for the Get request.

The example request is below. curl "https://curl.olsh.me/" ^ -H "authority: curl.olsh.me" ^ -H "accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,/;q=0.8,application/signed-exchange;v=b3;q=0.7" ^ -H "accept-language: tr-TR,tr;q=0.9,en-US;q=0.8,en;q=0.7" ^ -H "cache-control: no-cache" ^ -H "pragma: no-cache" ^ -H "referer: https://www.google.com/" ^ -H "sec-ch-ua: ^\^"Not.A/Brand^\^";v=^\^"8^\^", ^\^"Chromium^\^";v=^\^"114^\^", ^\^"Google Chrome^\^";v=^\^"114^\^"" ^ -H "sec-ch-ua-mobile: ?0" ^ -H "sec-ch-ua-platform: ^\^"Windows^\^"" ^ -H "sec-fetch-dest: document" ^ -H "sec-fetch-mode: navigate" ^ -H "sec-fetch-site: cross-site" ^ -H "sec-fetch-user: ?1" ^ -H "upgrade-insecure-requests: 1" ^ -H "user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36" ^ --compressed

As seen, this '^' character is added to the code. Could you please add the code for clearing the code on the left side?

olsh commented 1 year ago

I bielive that you use Windows and Chrome 114. Here is result from Chrome 114 on MacOS.

curl 'https://curl.olsh.me/' \
  -H 'authority: curl.olsh.me' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7' \
  -H 'accept-language: en-US,en;q=0.9,ru;q=0.8' \
  -H 'cache-control: no-cache' \
  -H 'dnt: 1' \
  -H 'pragma: no-cache' \
  -H 'referer: https://github.com/' \
  -H 'sec-ch-ua: "Not.A/Brand";v="8", "Chromium";v="114", "Google Chrome";v="114"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "macOS"' \
  -H 'sec-fetch-dest: document' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-site: cross-site' \
  -H 'sec-fetch-user: ?1' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36' \
  --compressed

I'll try to fix this when I have Windows PC.

ebubekirbastama commented 1 year ago

:) just a replace code is enough :) string request ="ebstime ^" string editcode =request.replace("^",""); :)

olsh commented 1 year ago

Nope, just replacing is not enough. What if you have a value with ^ char?