@Override
    public AttributedList<Path> list(final Path directory, final ListProgressListener listener) throws BackgroundException {
        if(directory.isRoot()) {
            final String bucket = RequestEntityRestStorageService.findBucketInHostname(session.getHost());
            if(StringUtils.isEmpty(bucket)) {
                if(log.isDebugEnabled()) {
                    log.debug(String.format("No bucket name in host %s", session.getHost().getHostname()));
                }
                // List all buckets
                try {
                    return new S3BucketListService(session).list(directory, listener);
                }
                catch(InteroperabilityException e) {
                    // Bucket set in hostname that leads to parser failure for XML reply
                    log.warn(String.format("Failure %s listing buckets", e));
                    try {
                        return this.listObjects(directory, listener);
                    }
                    catch(BackgroundException ignored) {
                        log.warn(String.format("Ignore failure %s listing objects", ignored));
                        // Throw original failure
                        throw e;
                    }
                }
            }
            // If bucket is specified in hostname, try to connect to this particular bucket only.
        }
        return this.listObjects(directory, listener);
    }
@Test
    public void testListMultipartUploadDot() throws Exception {
        final Path bucket = new Path("test-eu-central-1-cyberduck", EnumSet.of(Path.Type.directory, Path.Type.volume));
        final S3AccessControlListFeature acl = new S3AccessControlListFeature(session);
        final Path placeholder = new S3DirectoryFeature(session, new S3WriteFeature(session, acl), acl).mkdir(
                new Path(bucket, new AsciiRandomStringService().random(), EnumSet.of(Path.Type.directory, Path.Type.placeholder)), new TransferStatus());
        final MultipartUpload multipart = session.getClient().multipartStartUpload(bucket.getName(), String.format("%s/.", new S3PathContainerService(session.getHost()).getKey(placeholder)), Collections.emptyMap());
        assertNotNull(new S3ListService(session, acl).list(placeholder, new DisabledListProgressListener()).find(path -> path.getName().equals(".")));
        new S3DefaultMultipartService(session).delete(multipart);
        new S3DefaultDeleteFeature(session).delete(Collections.singletonList(placeholder), new DisabledPasswordCallback(), new Delete.DisabledCallback());
    }