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

Aberta
#109 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
Meio dia
Facilidade para iniciantes
65/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
rust
Domínio
backend

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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).

Linguagem predominante
TypeScript
Estrelas
4
Forks
1
Merge médio
4h 49min
PRs com merge (30d)
5

Preparar o ambiente

  • Inclui um Dockerfile ou arquivo Docker Compose
  • Sem modelo de pull request
  • Sem guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de tinystream-dev/tinystream

Todas as issues de tinystream-dev/tinystream

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.