From 2e27dcd2cfc09afd5108e8b86a32aba5405e925e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sat, 22 Nov 2025 22:52:46 +0100 Subject: [PATCH] Fix Invidious captions URL when companion is enabled Prefix caption URLs with /companion when invidiousCompanion is enabled in instance settings. This ensures captions are routed through the companion service, matching the behavior of video streams. --- Model/Applications/InvidiousAPI.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Model/Applications/InvidiousAPI.swift b/Model/Applications/InvidiousAPI.swift index 6bf75f81..375aa12f 100644 --- a/Model/Applications/InvidiousAPI.swift +++ b/Model/Applications/InvidiousAPI.swift @@ -858,7 +858,14 @@ final class InvidiousAPI: Service, ObservableObject, VideosAPI { private func extractCaptions(from content: JSON) -> [Captions] { content["captions"].arrayValue.compactMap { details in - guard let url = URL(string: details["url"].stringValue, relativeTo: account.url) else { return nil } + var urlString = details["url"].stringValue + + // Prefix with /companion if enabled + if account.instance.invidiousCompanion { + urlString = "/companion" + urlString + } + + guard let url = URL(string: urlString, relativeTo: account.url) else { return nil } return Captions( label: details["label"].stringValue,