Merge pull request #585 from dl1ely/master

Clean Windows paths before guessing the service name
This commit is contained in:
Ryan Baxter
2016-12-21 14:22:32 -05:00
committed by GitHub
2 changed files with 10 additions and 1 deletions

View File

@@ -111,7 +111,7 @@ public class PropertyPathEndpoint
Set<String> services = new LinkedHashSet<>();
if (path != null) {
String stem = StringUtils
.stripFilenameExtension(StringUtils.getFilename(path));
.stripFilenameExtension(StringUtils.getFilename(StringUtils.cleanPath(path)));
// TODO: correlate with service registry
int index = stem.indexOf("-");
while (index >= 0) {

View File

@@ -86,6 +86,15 @@ public class PropertyPathEndpointTests {
.toString());
}
@Test
public void testNotifyOneWithWindowsPath() throws Exception {
assertEquals("[foo]",
this.endpoint
.notifyByPath(new HttpHeaders(), Collections
.<String, Object> singletonMap("path", "C:\\config\\foo.yml"))
.toString());
}
@Test
public void testNotifyOneWithProfile() throws Exception {
assertEquals("[foo:local, foo-local]",