wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.77k stars 751 forks source link

paste curl when copy from chrome devtools, the command was added with the wrong escape character \ #3024

Closed ystyle closed 1 year ago

ystyle commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

ystyle@Archlinux  ~  neofetch
                   -`                    ystyle@Archlinux
                  .o+`                   ----------------
                 `ooo/                   OS: Arch Linux x86_64
                `+oooo:                  Host: XPS 13 7390
               `+oooooo:                 Kernel: 6.1.4-arch1-1
               -+oooooo+:                Uptime: 7 hours, 55 mins
             `/:-:++oooo+:               Packages: 1891 (pacman)
            `/++++/+++++++:              Shell: zsh 5.9
           `/++++++++++++++:             Resolution: 1920x1080
          `/+++ooooooooooooo/`           DE: Plasma 5.26.5
         ./ooosssso++osssssso+`          WM: KWin
        .oossssso-````/ossssss+`         WM Theme: Breeze 微风
       -osssssso.      :ssssssso.        Theme: Breeze Dark [Plasma], Breeze [GTK2/3]
      :osssssss/        osssso+++.       Icons: [Plasma], breeze-dark [GTK2/3]
     /ossssssss/        +ssssooo/-       Terminal: WezTerm
   `/ossssso+/:-        -:/+osssso+-     CPU: Intel i7-10710U (12) @ 4.700GHz
  `+sso+:-`                 `.-/+oso:    GPU: Intel Comet Lake UHD Graphics
 `++:.                           `-/+/   Memory: 13890MiB / 15691MiB
 .`                                 `/

Operating System: Arch Linux KDE Plasma Version: 5.26.5 KDE Frameworks Version: 5.101.0 Qt Version: 5.15.8 Kernel Version: 6.1.4-arch1-1 (64-bit) Graphics Platform: X11 Processors: 12 × Intel® Core™ i7-10710U CPU @ 1.10GHz Memory: 15.3 GiB of RAM Graphics Processor: Mesa Intel® UHD Graphics Manufacturer: Dell Inc. Product Name: XPS 13 7390

WezTerm version

20221119-145034-49b9839f

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

No, and I'll explain why below

Describe the bug

this command parse to wezterm, the command was added with the wrong escape character \

curl -X POST 'http://127.0.0.1:8080/api/em/mp/exchange' \
  -H 'Connection: keep-alive' \
  -H 'SessionID: 51301efa-9ed0-4401-8211-6eb57ea7781c' \
  -H 'em-debug: 16748905405948588521644797462' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzUxMiIsImtpZCI6IjdCSHhRQWNZdG85WUtDOGZQTW5nTUVEOFBpeDF3Y1llSTFYQkdNT3VSQmMiLCJ0eXAiOiJKV1QifQ.eyJBcHBJZCI6IjcxNTI1NTU4MzIyNjYzMzYiLCJPcmdJZCI6MTkzNjUyLCJfayI6ImMzNjQwYWI3OTYxNTQ3ZDk4NGZhZThkNTU5MmE0Mjk2IiwiZXhwIjoxNjc0OTE3NjcwLCJpYXQiOjE2NzQ4MzEyNzB9.VS9pKNC4oWepyW_tM6yT1ejCkjT4t2O5jKq2ujI9WD4ZINVM4D6QqG5BCEie7I14MGIvqFsutTtDXHaE-P575I4ko_oAyU7QCVBncKtlnQKI70BocAny9Pc3MJXVgUP8grNr_wy4vfkI4W5O2OUHZpRbsOBQrNMo9-Me0vTO-hs9Gv9i0MRpwvpa2U9kdN7fnfc0SbeXUqVlhs2xIUrm7vhX3zUHumb3eKv5ZK223uHjHoM3J9EYzc2CCr5aI8rF1kNSbPRTDvQ8Sws4BXefa__watFqzlK31vYVmS1H8qfCc6sDZ2DwyTF5sbZvHiqVUXfeuhDBBHDKlKN3NN_Hng' \
  -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1 wechatdevtools/1.06.2210310 MicroMessenger/8.0.5 webview/' \
  -H 'ACTCODE: CNY_2023' \
  -H 'content-type: application/json' \
  -H 'Accept: */*' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://servicewechat.com/wxdc98473a4cd44bdb/devtools/page-frame.html' \
  --data-binary '{"source":"","vipcode":"200065389","phone":"17607165422","openID":"osBX95ak59ds3s3VF3JVp2vZkifs","billType":"2","CouponList":[{"ID":180019,"Num":1,"SessionCategory":"默认1","SessionDate":"2023-02-01","SessionTimeStart":"11:00","SessionTimeEnd":"21:30","PartnerCount":0,"Items":[{"ID":150012,"Num":1,"Banner":"/assets/upload/f38a12b351a7a430be19c97003f5f116.png"},{"ID":150023,"Num":1,"Banner":"/assets/upload/ea8777fd0c968300131257e7fb2d6016.jpg"}]}]}' \
  --compressed

the error json format with \ :

\{"source":"","vipcode":"200065389","phone":"17607165422","openID":"osBX95ak59ds3s3VF3JVp2vZkifs","billType":"2","CouponList":\[\{"ID":180019,"Num":1,"SessionCategory":"默认1","SessionDate":"2023-02-","SessionTimeStart":"11:00","SessionTimeEnd":"21:30","PartnerCount":0,"Items":\[\{"ID":150012,"Num":1,"Banner":"/assets/upload/f38a12b351a7a430be19c97003f5f116.png"\},\{"ID":150023,"Num":1,"Banner":"/assets/upload/ea8777fd0c968300131257e7fb2d6016.jpg"\}\]\}\]\}

wezterm(error command): with character \ image

the same curl exec in terminator, it is correct. and delete http header: Authorization, it will be correct.

wezterm(correct command): image

To Reproduce

paste this command to wezterm

curl -X POST 'http://127.0.0.1:8080/api/em/mp/exchange' \
  -H 'Connection: keep-alive' \
  -H 'SessionID: 51301efa-9ed0-4401-8211-6eb57ea7781c' \
  -H 'em-debug: 16748905405948588521644797462' \
  -H 'Authorization: Bearer eyJhbGciOiJSUzUxMiIsImtpZCI6IjdCSHhRQWNZdG85WUtDOGZQTW5nTUVEOFBpeDF3Y1llSTFYQkdNT3VSQmMiLCJ0eXAiOiJKV1QifQ.eyJBcHBJZCI6IjcxNTI1NTU4MzIyNjYzMzYiLCJPcmdJZCI6MTkzNjUyLCJfayI6ImMzNjQwYWI3OTYxNTQ3ZDk4NGZhZThkNTU5MmE0Mjk2IiwiZXhwIjoxNjc0OTE3NjcwLCJpYXQiOjE2NzQ4MzEyNzB9.VS9pKNC4oWepyW_tM6yT1ejCkjT4t2O5jKq2ujI9WD4ZINVM4D6QqG5BCEie7I14MGIvqFsutTtDXHaE-P575I4ko_oAyU7QCVBncKtlnQKI70BocAny9Pc3MJXVgUP8grNr_wy4vfkI4W5O2OUHZpRbsOBQrNMo9-Me0vTO-hs9Gv9i0MRpwvpa2U9kdN7fnfc0SbeXUqVlhs2xIUrm7vhX3zUHumb3eKv5ZK223uHjHoM3J9EYzc2CCr5aI8rF1kNSbPRTDvQ8Sws4BXefa__watFqzlK31vYVmS1H8qfCc6sDZ2DwyTF5sbZvHiqVUXfeuhDBBHDKlKN3NN_Hng' \
  -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 15_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/15.0 Mobile/15E148 Safari/604.1 wechatdevtools/1.06.2210310 MicroMessenger/8.0.5 webview/' \
  -H 'ACTCODE: CNY_2023' \
  -H 'content-type: application/json' \
  -H 'Accept: */*' \
  -H 'Sec-Fetch-Site: cross-site' \
  -H 'Sec-Fetch-Mode: cors' \
  -H 'Sec-Fetch-Dest: empty' \
  -H 'Referer: https://servicewechat.com/wxdc98473a4cd44bdb/devtools/page-frame.html' \
  --data-binary '{"source":"","vipcode":"200065389","phone":"17607165422","openID":"osBX95ak59ds3s3VF3JVp2vZkifs","billType":"2","CouponList":[{"ID":180019,"Num":1,"SessionCategory":"默认1","SessionDate":"2023-02-01","SessionTimeStart":"11:00","SessionTimeEnd":"21:30","PartnerCount":0,"Items":[{"ID":150012,"Num":1,"Banner":"/assets/upload/f38a12b351a7a430be19c97003f5f116.png"},{"ID":150023,"Num":1,"Banner":"/assets/upload/ea8777fd0c968300131257e7fb2d6016.jpg"}]}]}' \
  --compressed

Configuration

local wezterm = require 'wezterm'
return {
  window_background_opacity = 0.9,
   -- window_background_image = '/home/ystyle/Pictures/壁纸/gamersky_018origin_035_2015741845474.jpg',
  window_background_image_hsb = {
    brightness = 0.9,
  },
  initial_cols = 120,
  hide_tab_bar_if_only_one_tab = true,
  tab_max_width = 40,
  font = wezterm.font 'JetBrains Mono',
  -- color_scheme = "darkmatrix",
  color_scheme = 'AlienBlood',
  default_cursor_style = 'BlinkingBar',
  -- window_decorations = "NONE",
  keys = {
        { key = 'p', mods = 'CTRL|SHIFT', action = wezterm.action.ShowLauncher },
        { key = 'UpArrow', mods = 'CTRL', action = wezterm.action.PaneSelect },
        { key = 'DownArrow', mods = 'CTRL', action = wezterm.action.SplitVertical { domain = 'CurrentPaneDomain' }},
        { key = 'RightArrow', mods = 'CTRL', action = wezterm.action.SplitHorizontal { domain = 'CurrentPaneDomain' }},
        { key = 'w', mods = 'CTRL', action = wezterm.action.CloseCurrentPane { confirm = true }},
  },
}

Expected Behavior

the http server get correct body

Logs

Debug Overlay wezterm version: 20221119-145034-49b9839f OpenGL version: Mesa Intel(R) UHD Graphics (CML GT2) 4.6 (Compatibility Profile) Mesa 22.3.2 Enter lua statements or expressions and hit Enter. Press ESC or CTRL-D to exit

Anything else?

wez commented 1 year ago

I'm sorry, but I don't understand the steps to reproduce this issue. wezterm doesn't parse curl; that's the job of the shell. Can you break this down more clearly into steps that I can try? Please explain what is shown in the screen shots.

ystyle commented 1 year ago

I'm sorry, but I don't understand the steps to reproduce this issue. wezterm doesn't parse curl; that's the job of the shell. Can you break this down more clearly into steps that I can try? Please explain what is shown in the screen shots.

Sorry, I made a typo, it should be paste. paste command to wezterm, the json format error with character \

wez commented 1 year ago

I can't reproduce this. Is there something you've configured in your shell, or some other software on your system that might be influencing what you're experiencing?

ystyle commented 1 year ago

It is normal for me to paste on the terminator. Both terminator and wezterm use zsh, the same user and the same configuration in zsh (paste with shift + ctrl + v) image

wez commented 1 year ago

if you launch zsh -f, which skips reading the various startup files, does this reproduce for you? If it doesn't, please work through your zsh startup to locate what it is that causes zsh to interpret the paste in this way so that I can reproduce it here, and then I can figure out what is happening.

ystyle commented 1 year ago

It is correct to paste the crul command after executing 'zsh - f' in wezterm. Is wezterm loading additional zsh plug-ins? Because it's normal in terminator and konsole

wez commented 1 year ago

No, wezterm doesn't know anything about your shell, however, it does start the shell as a login shell. Perhaps there is something in your shell startup that occurs only when run as a login shell? You can try running zsh -l in terminator and see if that makes it behave the same way.

ystyle commented 1 year ago

Wezterm: The command pasted after executing zsh - l is incorrect

Terminator: The command pasted after executing zsh - l is correct

wez commented 1 year ago

If zsh -f works, but zsh -l doesn't, there is something in your shell configuration that is responsible, and it is up to you find out what it is.

github-actions[bot] commented 1 year ago

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

github-actions[bot] commented 1 year ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.