diff --git a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt index 2c963d85..f82225ce 100644 --- a/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt +++ b/src/main/kotlin/app/revanced/patches/youtube/layout/branding/icon/patch/CustomBrandingPatch.kt @@ -10,6 +10,7 @@ import app.revanced.patcher.patch.annotations.Patch import app.revanced.patcher.patch.impl.ResourcePatch import app.revanced.patches.youtube.layout.branding.icon.annotations.CustomBrandingCompatibility import app.revanced.patches.youtube.misc.manifest.patch.FixLocaleConfigErrorPatch +import java.io.ByteArrayOutputStream import java.io.File import java.io.FileInputStream import java.io.InputStream @@ -45,9 +46,16 @@ class CustomBrandingPatch : ResourcePatch() { val iconFile = getIconStream("branding/$size/$iconName.png") ?: return PatchResultError("The icon $iconName can not be found.") + val outputStream = ByteArrayOutputStream() + iconFile.use { input -> + outputStream.use { output -> + input.copyTo(output) + } + } + Files.write( resDirectory.resolve("mipmap-$iconDirectory").resolve("$iconName.png").toPath(), - iconFile.readAllBytes() + outputStream.toByteArray() ) } }