Skip to content

Commit

Permalink
Add check if the file extension is null before calling the to toLower…
Browse files Browse the repository at this point in the history
…Case() - Fixes gh-20302
  • Loading branch information
mohammedalics committed Feb 24, 2020
1 parent 33c6be1 commit 740153b
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,16 @@ synchronized String retrieve(ServletWebRequest request, String name, String prof
// ensure InputStream will be closed to prevent file locks on Windows
try (InputStream is = resource.getInputStream()) {
String text = StreamUtils.copyToString(is, Charset.forName("UTF-8"));
String ext = StringUtils.getFilenameExtension(resource.getFilename())
.toLowerCase();
String ext = StringUtils.getFilenameExtension(resource.getFilename());
if (ext != null) {
ext = ext.toLowerCase();
}
Environment environment = this.environmentRepository.findOne(name, profile,
label, false);
if (resolvePlaceholders) {
text = resolvePlaceholders(prepareEnvironment(environment), text);
}
if (encryptEnabled && plainTextEncryptEnabled) {
if (ext != null && encryptEnabled && plainTextEncryptEnabled) {
ResourceEncryptor re = this.resourceEncryptorMap.get(ext);
if (re == null) {
logger.warn("Cannot decrypt for extension " + ext);
Expand Down

0 comments on commit 740153b

Please sign in to comment.