[Bug]: Case-insensitive replace in naming can splice at the wrong position

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

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

評価

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

調査の方向性

src/automation/naming.rs の replace_ci(56 行目)から始め、小文字化した文字列のバイトオフセットが、元の文字列を分割して置換を挿入するためにどのように使われているかを読んでください。小文字化によってバイト長が変わる needle を使った失敗するテストを、既存の naming テストの隣に追加してください(issue の İ -�3e i̇ のケース)。その後、このモジュールに対して cargo test を実行してください。置換が元の文字列での一致位置に反映され、新しいケースが通れば完了です。

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

説明

bug

[!NOTE]
This issue was written by Claude (Claude Opus 5.5) from a code review session with @PhrolovaMoe. It was found by reading the code and hasn't been reproduced on a running server.

Version

0.40.0 (feat/desktop, 017a837b)

Area

Torrents

What happened?

replace_ci finds the needle in hay.to_lowercase() and uses that byte offset to splice the original hay (src/automation/naming.rs:56). Lowercasing can change byte lengths (İ → i̇, for example), so the offsets don't line up: the char-boundary check stops a panic, but the replacement can land in the wrong place or be skipped.

Expected behavior

Replacements happen where the match is in the original string.

Suggested fix

Match case-insensitively on the original string (e.g. a case-insensitive regex with regex::escape(needle)), or map lowercase offsets back char by char.

主要言語
TypeScript
スター
4
フォーク
1
平均マージ
4時間 49分
マージ済み PR(30日)
5

環境構築

  • Dockerfile または Docker Compose ファイルあり
  • プルリクエストのテンプレートなし
  • コントリビューションガイドなし

はじめの一歩

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

tinystream-dev/tinystream のほかの issue

tinystream-dev/tinystream の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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