You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2021/12/03 08:32:21 UTC

[camel] branch main updated: CAMEL-17200: camel-google-storage - Fix includeFolders when set to false

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 0e663ef  CAMEL-17200: camel-google-storage - Fix includeFolders when set to false
0e663ef is described below

commit 0e663efd72805a3fbe6cd85b74793ab1540353c4
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Fri Dec 3 09:31:46 2021 +0100

    CAMEL-17200: camel-google-storage - Fix includeFolders when set to false
---
 .../component/google/storage/GoogleCloudStorageConsumer.java | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
index 1511b81..ef00abf 100644
--- a/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
+++ b/components/camel-google/camel-google-storage/src/main/java/org/apache/camel/component/google/storage/GoogleCloudStorageConsumer.java
@@ -140,11 +140,15 @@ public class GoogleCloudStorageConsumer extends ScheduledBatchPollingConsumer {
      * @return      true to include, false to exclude
      */
     protected boolean includeObject(Blob blob) {
-        if (getConfiguration().isIncludeFolders()) {
-            return true;
+        // is the blog a folder
+        boolean folder = blob.getName().endsWith("/");
+
+        if (folder && !getConfiguration().isIncludeFolders()) {
+            // we should not include folders
+            return false;
         }
-        // Config says to ignore folders/directories
-        return blob.getName().endsWith("/");
+
+        return true;
     }
 
     @Override