Skip to content

Commit 7322d1d

Browse files
andrey-qlogicJesseLovelace
authored andcommitted
---
yaml --- r: 16213 b: refs/heads/autosynth-firestore c: 4aa0737 h: refs/heads/master i: 16211: ebd50b7
1 parent 934fba3 commit 7322d1d

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
@@ -132,7 +132,7 @@ refs/heads/autosynth-containeranalysis: 039ca5b8db725c76c16a965ff26b2774322b8ef8
132132
refs/heads/autosynth-datastore: 9acd400b484d6691a080c9152a331d88d24fefc1
133133
refs/heads/autosynth-dialogflow: d7477419376eac9b6dcc7dbcede581152527351d
134134
refs/heads/autosynth-errorreporting: 9891e73a56af7c097829ca7a521b0e862ba6af30
135-
refs/heads/autosynth-firestore: 1ee33dce9c137938be0650f065717700d78f9bf6
135+
refs/heads/autosynth-firestore: 4aa0737f6c32ffe4057a3f6a3b22fb9d3620e0eb
136136
refs/heads/autosynth-iot: 9d732be07d99843d8cb53d34ec0837328a807fce
137137
refs/heads/autosynth-kms: dcc6e15d68759010c8735cc868135bd7e6c1cc5f
138138
refs/heads/autosynth-language: 8972866b016473559702424205ce5569de47b34d

branches/autosynth-firestore/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-firestore/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)