Skip to content

Commit

Permalink
Polish
Browse files Browse the repository at this point in the history
  • Loading branch information
scottfrederick committed Mar 22, 2024
1 parent 985918b commit 672c631
Showing 1 changed file with 4 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,14 @@ class Base64ProtocolResolver implements ProtocolResolver {
@Override
public Resource resolve(String location, ResourceLoader resourceLoader) {
if (location.startsWith(BASE64_PREFIX)) {
return new Base64ByteArrayResource(location.substring(BASE64_PREFIX.length()));
String value = location.substring(BASE64_PREFIX.length());
return new ByteArrayResource(decode(value));
}
return null;
}

static class Base64ByteArrayResource extends ByteArrayResource {

Base64ByteArrayResource(String location) {
super(Base64.getDecoder().decode(location.getBytes()));
}

private static byte[] decode(String location) {
return Base64.getDecoder().decode(location);
}

}

0 comments on commit 672c631

Please sign in to comment.