From e924e0a1a061836dfa7b2d03d8b25c5c4669a2cd Mon Sep 17 00:00:00 2001 From: Claudemirovsky <63046606+Claudemirovsky@users.noreply.github.com> Date: Sun, 10 Mar 2024 16:02:24 -0300 Subject: [PATCH] fix(lib/playlist-utils): Revert #3032 (#3039) --- .../kanade/tachiyomi/lib/playlistutils/PlaylistUtils.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/playlist-utils/src/main/java/eu/kanade/tachiyomi/lib/playlistutils/PlaylistUtils.kt b/lib/playlist-utils/src/main/java/eu/kanade/tachiyomi/lib/playlistutils/PlaylistUtils.kt index 43c67b684f..ac9ab1abcb 100644 --- a/lib/playlist-utils/src/main/java/eu/kanade/tachiyomi/lib/playlistutils/PlaylistUtils.kt +++ b/lib/playlist-utils/src/main/java/eu/kanade/tachiyomi/lib/playlistutils/PlaylistUtils.kt @@ -5,7 +5,6 @@ import eu.kanade.tachiyomi.animesource.model.Video import eu.kanade.tachiyomi.network.GET import eu.kanade.tachiyomi.util.asJsoup import okhttp3.Headers -import okhttp3.HttpUrl import okhttp3.HttpUrl.Companion.toHttpUrl import okhttp3.OkHttpClient import okhttp3.internal.commonEmptyHeaders @@ -106,8 +105,9 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade val masterUrlBasePath = playlistHttpUrl.newBuilder().apply { removePathSegment(playlistHttpUrl.pathSize - 1) addPathSegment("") + query(null) fragment(null) - }.build() + }.build().toString() // Get subtitles val subtitleTracks = subtitleList + SUBTITLE_REGEX.findAll(masterPlaylist).mapNotNull { @@ -146,14 +146,14 @@ class PlaylistUtils(private val client: OkHttpClient, private val headers: Heade } } - private fun getAbsoluteUrl(url: String, playlistUrl: String, masterBase: HttpUrl): String? { + private fun getAbsoluteUrl(url: String, playlistUrl: String, masterBase: String): String? { return when { url.isEmpty() -> null url.startsWith("http") -> url url.startsWith("//") -> "https:$url" url.startsWith("/") -> playlistUrl.toHttpUrl().newBuilder().encodedPath("/").build().toString() .substringBeforeLast("/") + url - else -> masterBase.newBuilder().addEncodedPathSegments(url).build().toString() + else -> masterBase + url } }