Rename/Move silently appends Subtitle to Title even when naming pattern doesn't reference {Subtitle}

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

RenameService.Helpers.cs の BuildNamingVariables から始めます。ここで issue はサブタイトルのフォールバックを特定しています。フォルダーとファイルの命名パターンが {Title} の値にどう影響するかを確認し、次に {Subtitle} を含まないパターンの名前変更プレビューのテストを実行します。パターンが {Subtitle} を明示的に参照していない限り、プレビュー名が audiobook.Title のみを使うようになれば完了です。

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

説明

RenameService.Helpers.cs → BuildNamingVariables automatically combines {Title} with
{Subtitle} (format "{Title}: {Subtitle}") whenever the configured naming pattern (folder
or file pattern) does not explicitly contain the {Subtitle} token. This causes folder/file
names to include the subtitle even though the user never configured that anywhere.

Steps to reproduce

  1. Set FolderNamingPattern to {Author}/{Series}/{SeriesNumber:00} - {Title}
    (no {Subtitle} included)
  2. Update an audiobook that has a Subtitle value set via rescan-metadata
  3. Call /library/{id}/rename/preview

Expected: folder name Gunter Arentzen/Series/01 - Title
Actual: folder name additionally includes the subtitle, e.g.
Gunter Arentzen/Series/Title - Series (the colon gets sanitized to " - " for the filesystem)

Root cause

// RenameService.Helpers.cs, BuildNamingVariables()
var usesSubtitleToken = (!string.IsNullOrWhiteSpace(folderPattern) && folderPattern.IndexOf("Subtitle", ...) >= 0)
    || (!string.IsNullOrWhiteSpace(filePattern) && filePattern.IndexOf("Subtitle", ...) >= 0);
var combinedTitle = !usesSubtitleToken
    && !string.IsNullOrWhiteSpace(audiobook.Subtitle)
    && !string.IsNullOrWhiteSpace(audiobook.Title)
    && !audiobook.Title.Contains(audiobook.Subtitle, StringComparison.OrdinalIgnoreCase)
    ? $"{audiobook.Title}: {audiobook.Subtitle}"
    : audiobook.Title;

The fallback triggers regardless of the actually configured pattern — there's no way to disable
this behavior other than leaving Subtitle empty.

Suggested fix

Remove the automatic fallback (or make it configurable) — {Title} should strictly follow
audiobook.Title unless the naming pattern explicitly references {Subtitle}.

主要言語
C#
スター
901
フォーク
70
平均マージ
16時間 27分
マージ済み PR(30日)
60

環境構築

はじめの一歩

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

Listenarrs/Listenarr のほかの issue

Listenarrs/Listenarr の issue をすべて見る

似ている issue

C# の issue をもっと見る

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

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