Skip to content

Commit ce42522

Browse files
andrey-qlogicJesseLovelace
authored andcommitted
---
yaml --- r: 13541 b: refs/heads/autosynth-dlp c: 4aa0737 h: refs/heads/master i: 13539: ea5d16e
1 parent 78556d4 commit ce42522

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
@@ -104,7 +104,7 @@ refs/tags/v0.60.0: 4cd518d0612329f8a8e53484eef4cd1651e32855
104104
refs/tags/v0.61.0: e4b526656bb1bf5eefd0ee578b7405147821225e
105105
refs/tags/v0.62.0: bbede7385d48ba08f487bdd29ec10668ace96396
106106
refs/heads/0.60.0-alpha: 10939381ffe0b8da32db4fe3087c86e3aa7f3e55
107-
refs/heads/autosynth-dlp: 1ee33dce9c137938be0650f065717700d78f9bf6
107+
refs/heads/autosynth-dlp: 4aa0737f6c32ffe4057a3f6a3b22fb9d3620e0eb
108108
refs/heads/autosynth-logging: f8794c50a64f62b167cddf42513d133547679e01
109109
refs/heads/dupes: 3478c5d81fd242d0e985656645a679420a2060c2
110110
refs/tags/v0.63.0: 94f19b71d40f46b36120e7b9d78a1a3d41bfcbd6

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