Cherry picking 34ac90c on top of the 2.2.x branch
This commit is contained in:
@@ -145,14 +145,16 @@ public class ResourceController {
|
||||
// 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);
|
||||
|
||||
@@ -175,6 +175,13 @@ public class ResourceControllerTests {
|
||||
assertThat(resource).isEqualToIgnoringNewLines("foo: dev_bar/spam");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceWithoutFileExtension() throws Exception {
|
||||
this.environmentRepository.setSearchLocations("classpath:/test");
|
||||
String resource = this.controller.retrieve("foo", "bar", "dev", "foo", true);
|
||||
assertThat(resource).isEqualToIgnoringNewLines("foo: dev_bar");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resourceWithSlash() throws Exception {
|
||||
this.environmentRepository.setSearchLocations("classpath:/test");
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
foo: dev_bar
|
||||
Reference in New Issue
Block a user