Skip to content

Commit 1163a57

Browse files
committed
Log on more bad n resolving conditions
1 parent 8d4bd86 commit 1163a57

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

common/src/main/java/dev/lavalink/youtube/cipher/SignatureCipherManager.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,19 @@ public URI resolveFormatUrl(@NotNull HttpInterface httpInterface, @NotNull Strin
132132
if (!DataFormatTools.isNullOrEmpty(nParameter)) {
133133
try {
134134
String transformed = cipher.transform(nParameter, scriptEngine);
135+
String logMessage = null;
136+
137+
if (transformed == null) {
138+
logMessage = "Transformed n parameter is null, n function possibly faulty";
139+
} else if (nParameter.equals(transformed)) {
140+
logMessage = "Transformed n parameter is the same as input, n function possibly short-circuited";
141+
} else if (transformed.contains("enhanced_except_") || transformed.endsWith("_w8_" + nParameter)) {
142+
logMessage = "N function did not complete due to exception";
143+
}
135144

136-
if (nParameter.equals(transformed)) {
137-
log.warn("Transformed n parameter is the same as input, n function possibly short-circuited (in: {}, out: {}, player script: {}, source version: {})",
138-
nParameter, transformed, playerScript, YoutubeSource.VERSION);
145+
if (logMessage != null) {
146+
log.warn("{} (in: {}, out: {}, player script: {}, source version: {})",
147+
logMessage, nParameter, transformed, playerScript, YoutubeSource.VERSION);
139148
}
140149

141150
uri.setParameter("n", transformed);

0 commit comments

Comments
 (0)