[Bug]: Renaming a library to an existing name merges the two libraries

オープン
#109 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

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

調査の方向性

Start at src/api/settings.rs:306 in updateLibrary, where the rename is committed before config.update_library runs. Read Config::validate to see where the duplicate-name check lives, then reorder or pre-validate so the name is checked against the other libraries before any database write. Done means renaming A to B returns the "two libraries are called" error with no items, tracks, stars, ratings or permission lists relabeled; the issue notes this was found by reading code and not yet reproduced, so build a two-library case first.

索引モデルが 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

Config

What happened?

updateLibrary renames the library in the database and commits (src/api/settings.rs:306) before calling config.update_library, which is where duplicate names are rejected (Config::validate). Renaming A to an existing B relabels all of A's items, skipped files, tracks, albums, artists, stars and ratings as B, then returns an error. The config still lists both libraries, and A's titles now show up in B. Permission lists are renamed only after the commit, so they're left pointing at A.

Steps to reproduce
  1. Have two libraries, A and B.
  2. Rename A to B in settings: you get "two libraries are called "B"".
  3. B now contains A's titles and A is empty.
Expected behavior

The rename is refused before anything in the database changes.

Suggested fix

Validate the new name against the other libraries first (or apply the config change first and only rename in the DB once it succeeded).

主要言語
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 を短くまとめたダイジェスト。