@Override
    public Name getLocation(final Path file) throws BackgroundException {
        if(StringUtils.isNotBlank(session.getHost().getRegion())) {
            return new S3Region(session.getHost().getRegion());
        }
        final Path bucket = containerService.getContainer(file);
        return this.getLocation(bucket.isRoot() ? StringUtils.EMPTY : bucket.getName());
    }
@Test
    public void testAccessBucketNameInHostname() throws Exception {
        final RegionEndpointCache cache = virtualhost.getClient().getRegionEndpointCache();
        assertEquals(new S3LocationFeature.S3Region("eu-west-3"), new S3LocationFeature(virtualhost, cache).getLocation(
                new Path("/", EnumSet.of(Path.Type.directory))
        ));
        assertEquals("eu-west-3", cache.getRegionForBucketName(""));
    }