Non-UTF-8 paths send empty heartbeats on Neovim; g:aw_hostname is not URL-encoded

オープン 初心者向け
#34 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
vim
領域
tooling

調査の方向性

HTTPPostJson と s:bucket_apiurl を構築するコードから始めてください。修正が触れるのはこの 2 箇所だけです。Neovim 0.9.5 で、caf\xe9.txt のようなパスと、let g:aw_hostname を 'my laptop'、'host#1'、'a/b' に設定した場合で再現してください。失敗する json_encode が空の body を post しなくなり、bucket id が percent-encoded されて、サーバー上で作成される bucket が :AWStatus の報告と一致したら完了です。

索引モデルが issue の本文から書いたものです。

説明

Two smaller request-building bugs found while testing ActivityWatch/aw-watcher-vim#32. Both reproduced on master 4ba86d0 with Neovim 0.9.5.

1. A non-UTF-8 file path or cwd sends empty heartbeats (Neovim only). On Neovim, json_encode fails with E474 ... does not start any UTF-8 character on a path such as caf\xe9.txt. HTTPPostJson has no abort, so curl posts an empty body, and every heartbeat produces an E474 plus a status code 400 error. A non-UTF-8 working directory affects every buffer. Vim does not hit this: its json_encode substitutes U+FFFD, so the heartbeat succeeds with a mangled path.
Fix idea: skip the send when json_encode fails (try/catch), or encode the path lossily first.

2. g:aw_hostname is pasted into URLs without percent-encoding. Each value fails differently:

  • my laptop: curl rejects the URL (exit 3), which is reported as "Failed to connect".
  • host#1: curl drops everything after #, so it creates aw-watcher-vim_host while :AWStatus says running, then every heartbeat gets a 422.
  • a/b: the request gets a 404.

This only matters when the user overrides the hostname, since the default from hostname() is URL-safe.
Fix idea: percent-encode the bucket id when building s:bucket_apiurl.

主要言語
Vim Script
スター
124
フォーク
15
PR マージ指標
30日以内にマージされた PR はありません

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ActivityWatch/aw-watcher-vim のほかの issue

ActivityWatch/aw-watcher-vim の issue をすべて見る

似ている issue

DevTools の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。