Skip to content

Commit 16adfd4

Browse files
andrey-qlogicJesseLovelace
authored andcommitted
---
yaml --- r: 12921 b: refs/heads/autosynth-bigtable c: 4aa0737 h: refs/heads/master i: 12919: e2f2d0e
1 parent 22ef08f commit 16adfd4

3 files changed

Lines changed: 16 additions & 1 deletion

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ refs/heads/autosynth-asset: af3772eb76acbfc401f7c3f9310f09f2b0e17602
126126
refs/heads/autosynth-automl: d4315b3596bac160e3439432c54435f44b09953e
127127
refs/heads/autosynth-bigquerydatatransfer: 2a9f3938237f85a8919602d74011326580ff387f
128128
refs/heads/autosynth-bigquerystorage: 99aee05df348f39d98b6fb23c292006f1d2a6c28
129-
refs/heads/autosynth-bigtable: 1ee33dce9c137938be0650f065717700d78f9bf6
129+
refs/heads/autosynth-bigtable: 4aa0737f6c32ffe4057a3f6a3b22fb9d3620e0eb
130130
refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
131131
refs/heads/autosynth-containeranalysis: 781fdb430a60f9a6491f116e31e4e10118157bdb
132132
refs/heads/autosynth-datastore: af1fb76aa3eee02fe6f31f8fa1c72a4f048d149b

branches/autosynth-bigtable/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/main/java/com/google/cloud/storage/contrib/nio/CloudStorageFileSystemProvider.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,12 @@ public <A extends BasicFileAttributes> A readAttributes(
768768
}
769769
CloudStorageObjectAttributes ret;
770770
ret = new CloudStorageObjectAttributes(blobInfo);
771+
// if size is 0 it could be a folder
772+
if (ret.size() == 0 && cloudPath.seemsLikeADirectoryAndUsePseudoDirectories(storage)) {
773+
@SuppressWarnings("unchecked")
774+
A result = (A) new CloudStoragePseudoDirectoryAttributes(cloudPath);
775+
return result;
776+
}
771777
@SuppressWarnings("unchecked")
772778
A result = (A) ret;
773779
return result;

branches/autosynth-bigtable/google-cloud-clients/google-cloud-contrib/google-cloud-nio/src/test/java/com/google/cloud/storage/contrib/nio/CloudStorageFileAttributesTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
public class CloudStorageFileAttributesTest {
3939

4040
private static final byte[] HAPPY = "(✿◕ ‿◕ )ノ".getBytes(UTF_8);
41+
private static final byte[] EMPTY = "".getBytes(UTF_8);
4142

4243
private Path path;
4344
private Path dir;
@@ -104,6 +105,14 @@ public void testIsDirectory() throws IOException {
104105
assertThat(Files.readAttributes(dir, CloudStorageFileAttributes.class).isDirectory()).isTrue();
105106
}
106107

108+
@Test
109+
public void testIsPseudoDirectory() throws IOException {
110+
Files.write(path, EMPTY);
111+
assertThat(Files.readAttributes(path, CloudStorageFileAttributes.class).isDirectory())
112+
.isFalse();
113+
assertThat(Files.readAttributes(dir, CloudStorageFileAttributes.class).isDirectory()).isTrue();
114+
}
115+
107116
@Test
108117
public void testIsRegularFile() throws IOException {
109118
Files.write(path, HAPPY);

0 commit comments

Comments
 (0)