v1.7.153 zwei Production-Regressionen aus v1.7.151 gefixt
Aus dem live Rename-Log + Library-Screenshot:
(1) .nfo Files landeten in der MKV-Library
moveCompanionFiles() hatte ".nfo" in der Extensions-Liste — sollte
nur fuer Subtitles gemoved werden. .nfo gehoert nicht in die
Library. Aus dem Set entfernt; renameCompanionFiles laesst .nfo
weiterhin mit-umbenennen (im Extract-Dir, harmlos), aber MKV-Move
bringt sie nicht mehr in die Library.
(2) Vollstaendige Scene-Namen wurden auf "Show.SxxExx.mkv" gekuerzt
buildSafeAutoRenameTargetPath hatte ein 247-Zeichen Total-Path-Cap,
das vollstaendige Scene-Releases wie
"Dr.House.S04E02.Der.Stoff.aus.dem.die.Heldin.ist.GERMAN.5.1.DL.AC3.720p.BDRiP.x264-TvR.mkv"
abgelehnt hat → Fallback aktiviert → "Dr.House.S04E02.mkv".
Die ABER renamePathWithExdevFallback wraps eh ueber
toWindowsLongPathIfNeeded (\?\ Prefix), und der Endpfad nach
MKV-Move ist viel kuerzer (Library-Dir-Prefix). Cap war
ueberhaupt nicht noetig und hat aktiv schoene Namen abgesaegt.
Cap entfernt; nur das 255-char NTFS Filename-Limit bleibt.
Test: neuer Test "mkv-move moves SUBTITLES to library but NOT .nfo
metadata files". 592/592 Tests gruen.
Im naechsten Schritt: Fix-Skript fuer den User damit existierende
Library-Files (mit .nfo + zu kurzen Namen) korrigiert werden ohne
Re-Download.
This commit is contained in:
@@ -3686,15 +3686,16 @@ export class DownloadManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
/** Move matching subtitle / metadata companions alongside a video that
|
||||
* was just collected into the library. Mirrors renameCompanionFiles but
|
||||
* for cross-directory moves. */
|
||||
/** Move matching SUBTITLE companions alongside a video collected into the
|
||||
* library. Note: .nfo / metadata files are intentionally NOT moved — the
|
||||
* library should contain video + subs only. .nfo stays in the extract
|
||||
* dir and is removed by normal cleanup. */
|
||||
private async moveCompanionFiles(
|
||||
sourceVideoPath: string,
|
||||
targetVideoPath: string,
|
||||
pkg?: PackageEntry
|
||||
): Promise<void> {
|
||||
const COMPANION_EXTENSIONS = new Set([".srt", ".ass", ".ssa", ".sub", ".idx", ".vtt", ".smi", ".nfo"]);
|
||||
const COMPANION_EXTENSIONS = new Set([".srt", ".ass", ".ssa", ".sub", ".idx", ".vtt", ".smi"]);
|
||||
const sourceDir = path.dirname(sourceVideoPath);
|
||||
const targetDir = path.dirname(targetVideoPath);
|
||||
const sourceVideoBase = path.basename(sourceVideoPath, path.extname(sourceVideoPath));
|
||||
@@ -3776,17 +3777,18 @@ export class DownloadManager extends EventEmitter {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Windows MAX_PATH is 260 chars without the \\?\ long-path prefix.
|
||||
// The actual rename via renamePathWithExdevFallback ALWAYS wraps with
|
||||
// toWindowsLongPathIfNeeded, so paths up to ~32K technically work, but
|
||||
// many downstream consumers (Explorer, MediaPlayers, scripts) struggle
|
||||
// beyond ~248. Use a conservative 247-char limit so the renamed file
|
||||
// remains usable. Caller will fall back to buildShortPackageFallback
|
||||
// when this returns null.
|
||||
const SAFE_TOTAL_PATH_CHARS = 247;
|
||||
if (candidatePath.length > SAFE_TOTAL_PATH_CHARS) {
|
||||
return null;
|
||||
}
|
||||
// Note: total-path length is intentionally NOT checked here. We used to
|
||||
// cap it at 247 chars (v1.7.151) on the assumption that paths beyond
|
||||
// Windows MAX_PATH (260) would fail or be unusable downstream. That
|
||||
// turned out to be ACTIVELY HARMFUL: renamePathWithExdevFallback wraps
|
||||
// every rename via toWindowsLongPathIfNeeded (\\?\ prefix), and the
|
||||
// file ends up in the library dir after mkv-move where the parent path
|
||||
// is short. Imposing a 247-char cap on the EXTRACT-dir intermediate
|
||||
// path threw away perfectly-good scene-release names like
|
||||
// "Dr.House.S04E02.Der.Stoff.aus.dem.die.Heldin.ist.GERMAN.5.1.DL.AC3.720p.BDRiP.x264-TvR.mkv"
|
||||
// and replaced them with ugly "Dr.House.S04E02.mkv" via fallback.
|
||||
// We rely on the long-path prefix for the rename and on the 255-char
|
||||
// NTFS file-name limit above for the actual constraint.
|
||||
|
||||
return candidatePath;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user