diff --git a/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/requests/SBRequester.java b/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/requests/SBRequester.java index 6a36a2525..445b711dc 100644 --- a/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/requests/SBRequester.java +++ b/extensions/youtube/src/main/java/app/revanced/extension/youtube/sponsorblock/requests/SBRequester.java @@ -150,11 +150,16 @@ public class SBRequester { String end = String.format(Locale.US, TIME_TEMPLATE, endTime / 1000f); String duration = String.format(Locale.US, TIME_TEMPLATE, videoLength / 1000f); - HttpURLConnection connection = getConnectionFromRoute(SBRoutes.SUBMIT_SEGMENTS, privateUserId, videoId, category, start, end, duration); + HttpURLConnection connection = getConnectionFromRoute(SBRoutes.SUBMIT_SEGMENTS, + privateUserId, videoId, category, start, end, duration); final int responseCode = connection.getResponseCode(); - String userMessage = switch (responseCode) { - case HTTP_STATUS_CODE_SUCCESS -> str("revanced_sb_submit_succeeded"); + if (responseCode == HTTP_STATUS_CODE_SUCCESS) { + Utils.showToastLong(str("revanced_sb_submit_succeeded")); + return; + } + + String userErrorMessage = switch (responseCode) { case 409 -> str("revanced_sb_submit_failed_duplicate"); case 403 -> str("revanced_sb_submit_failed_forbidden", Requester.parseErrorStringAndDisconnect(connection)); @@ -167,7 +172,7 @@ public class SBRequester { // Message might be about the users account or an error too large to show in a toast. // Use a dialog instead. - SponsorBlockUtils.showErrorDialog(userMessage); + SponsorBlockUtils.showErrorDialog(userErrorMessage); } catch (SocketTimeoutException ex) { Logger.printDebug(() -> "Timeout", ex); Utils.showToastLong(str("revanced_sb_submit_failed_timeout"));