From 41a33634eec3648ae0cd1582e9853f5d71e47e62 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 23 Nov 2025 12:00:02 +0100 Subject: [PATCH] Fix YouTube share links including port from Invidious instance Fixes #870 where YouTube share links incorrectly included the port number from the user's Invidious instance URL (e.g., http://www.youtube.com:3000 instead of http://www.youtube.com). Added defensive logic to explicitly clear the port when creating share URLs with frontend URL strings containing "youtube.com". This ensures YouTube share links always use the standard format without port numbers, regardless of the user's instance configuration. --- Model/Applications/VideosAPI.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Model/Applications/VideosAPI.swift b/Model/Applications/VideosAPI.swift index a7614956..07e30231 100644 --- a/Model/Applications/VideosAPI.swift +++ b/Model/Applications/VideosAPI.swift @@ -114,6 +114,10 @@ extension VideosAPI { let frontendURL = URL(string: frontendURLString) { urlComponents = URLComponents(url: frontendURL, resolvingAgainstBaseURL: false) + // Ensure port is not included when sharing to external frontends like YouTube + if frontendURLString.contains("youtube.com") { + urlComponents?.port = nil + } } else if let instanceComponents = account?.instance?.urlComponents { urlComponents = instanceComponents }