Skip to content

Commit 2af2f6c

Browse files
committed
Fixed some sematics issues
1 parent 15f1c7e commit 2af2f6c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

plugin/src/main/java/io/jenkins/plugins/casc/SecretSourceResolver.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -201,23 +201,18 @@ static class DecodeBase64Lookup implements StringLookup {
201201

202202
@Override
203203
public String lookup(@NonNull final String key) {
204-
if (StringUtils.isBlank(key)) {
205-
return "";
206-
}
207204

208205
final String value = key.trim();
209206

210-
if (value.startsWith("-----BEGIN ")) {
211-
return value;
207+
if (value.isEmpty()) {
208+
return "";
212209
}
213210

214-
String compact = value.replaceAll("\\s+", "");
215-
216211
try {
217-
return new String(Base64.getDecoder().decode(compact), StandardCharsets.UTF_8);
212+
return new String(Base64.getDecoder().decode(value), StandardCharsets.UTF_8);
218213
} catch (IllegalArgumentException e) {
219214
try {
220-
return new String(Base64.getUrlDecoder().decode(compact), StandardCharsets.UTF_8);
215+
return new String(Base64.getUrlDecoder().decode(value), StandardCharsets.UTF_8);
221216
} catch (IllegalArgumentException e2) {
222217
LOGGER.log(
223218
Level.WARNING,

0 commit comments

Comments
 (0)