{"action":"created","issue":{"url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/900","repository_url":"https://api.github.com/repos/aws/aws-sdk-cpp","labels_url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/900/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/900/comments","events_url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/900/events","html_url":"https://github.com/aws/aws-sdk-cpp/issues/900","id":334349645,"node_id":"MDU6SXNzdWUzMzQzNDk2NDU=","number":900,"title":"ListObject API shows single object if we drag and drop directory structure from s3 console","user":{"login":"sdjunaidali","id":15814146,"node_id":"MDQ6VXNlcjE1ODE0MTQ2","avatar_url":"https://avatars2.githubusercontent.com/u/15814146?v=4","gravatar_id":"","url":"https://api.github.com/users/sdjunaidali","html_url":"https://github.com/sdjunaidali","followers_url":"https://api.github.com/users/sdjunaidali/followers","following_url":"https://api.github.com/users/sdjunaidali/following{/other_user}","gists_url":"https://api.github.com/users/sdjunaidali/gists{/gist_id}","starred_url":"https://api.github.com/users/sdjunaidali/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdjunaidali/subscriptions","organizations_url":"https://api.github.com/users/sdjunaidali/orgs","repos_url":"https://api.github.com/users/sdjunaidali/repos","events_url":"https://api.github.com/users/sdjunaidali/events{/privacy}","received_events_url":"https://api.github.com/users/sdjunaidali/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-21T06:00:48Z","updated_at":"2018-06-28T20:01:22Z","closed_at":null,"author_association":"NONE","body":"### Ubuntu 14.04 \r\n\r\n### AWS SDK for S3 using C++\r\n\r\n### Compiler: gcc version 4.8.5\r\n\r\n## Steps to produce the bug:\r\n\r\n1) Drag and drop directory structure on s3 console and upload the hierarchy.\r\ne.g: dir1/dir2/dir3/dir4/abc.txt \r\nupload dir1 directory at once using drag and drop on s3 console.\r\n\r\n2) Compile the below code for list objects using \r\ng++ -std=c++11 list_object.cpp -laws-cpp-sdk-core -laws-cpp-sdk-s3 \r\n\r\n3) Run the binary using\r\nEx: ./a.out \"bucket name\"\r\n\r\n4) Output:\r\n* dir1/dir2/dir3/dir4/abc.txt\r\nSingle Path \r\n\r\nExpected Output:\r\n* dir1/\r\n* dir1/dir2/\r\n* dir1/dir2/dir3/\r\n* dir1/dir2/dir3/dir4/\r\n* dir1/dir2/dir3/dir4/abc.txt\r\n\r\nNote: If we make a directory hierarchy using create folder option on S3 console then we are getting expected output, Problem is if we upload the directory structure at once using drag and drop.**\r\n\r\n**sample program to list objects:**\r\n\r\n#include <aws/core/Aws.h>\r\n#include <aws/s3/S3Client.h>\r\n#include <aws/core/auth/AWSCredentialsProvider.h>\r\n#include <aws/s3/model/Bucket.h>\r\n#include <aws/s3/model/Object.h>\r\n#include <aws/s3/model/ListObjectsV2Request.h>\r\n\r\n/**\r\n * List objects (keys) within an Amazon S3 bucket.\r\n */\r\nint main(int argc, char** argv)\r\n{\r\n    Aws::SDKOptions options;\r\n    Aws::InitAPI(options);\r\n    {\r\n        if (argc < 2)\r\n        {\r\n            std::cout << std::endl <<\r\n                \"To run this example, supply the name of a bucket to list!\" <<\r\n                std::endl << \"Ex: list_objects <bucket-name> \" << std::endl\r\n                << std::endl;\r\n            exit(1);\r\n        }\r\n\r\n        const Aws::String bucket_name = argv[1];\r\n        std::cout << \"Objects in S3 bucket: \" << bucket_name << std::endl;\r\n\r\n        Aws::Client::ClientConfiguration clientConfig;\r\n        clientConfig.region = \"ap-south-1\";\r\n        Aws::S3::S3Client s3_client(clientConfig);\r\n\r\n        Aws::S3::Model::ListObjectsV2Request objects_request;\r\n        objects_request.WithBucket(bucket_name);\r\n\r\n        auto list_objects_outcome = s3_client.ListObjectsV2(objects_request);\r\n\r\n        if (list_objects_outcome.IsSuccess())\r\n        {\r\n            Aws::Vector<Aws::S3::Model::Object> object_list =\r\n                list_objects_outcome.GetResult().GetContents();\r\n\r\n            if(object_list.size() == 0) {\r\n                std::cout << \"*Object List Size* \" << object_list.size() << std::endl;\r\n                return 1;\r\n            }\r\n\r\n            for (auto const &s3_object : object_list)\r\n            {\r\n                std::cout << \"* \" << s3_object.GetKey() << std::endl;\r\n            }\r\n        }\r\n        else\r\n        {\r\n            std::cout << \"ListObjects error: \" <<\r\n                list_objects_outcome.GetError().GetExceptionName() << \" \" <<\r\n                list_objects_outcome.GetError().GetMessage() << std::endl;\r\n        }\r\n    }\r\n\r\n    Aws::ShutdownAPI(options);\r\n}\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/comments/401155540","html_url":"https://github.com/aws/aws-sdk-cpp/issues/900#issuecomment-401155540","issue_url":"https://api.github.com/repos/aws/aws-sdk-cpp/issues/900","id":401155540,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTE1NTU0MA==","user":{"login":"marcomagdy","id":115965,"node_id":"MDQ6VXNlcjExNTk2NQ==","avatar_url":"https://avatars0.githubusercontent.com/u/115965?v=4","gravatar_id":"","url":"https://api.github.com/users/marcomagdy","html_url":"https://github.com/marcomagdy","followers_url":"https://api.github.com/users/marcomagdy/followers","following_url":"https://api.github.com/users/marcomagdy/following{/other_user}","gists_url":"https://api.github.com/users/marcomagdy/gists{/gist_id}","starred_url":"https://api.github.com/users/marcomagdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcomagdy/subscriptions","organizations_url":"https://api.github.com/users/marcomagdy/orgs","repos_url":"https://api.github.com/users/marcomagdy/repos","events_url":"https://api.github.com/users/marcomagdy/events{/privacy}","received_events_url":"https://api.github.com/users/marcomagdy/received_events","type":"User","site_admin":false},"created_at":"2018-06-28T20:01:22Z","updated_at":"2018-06-28T20:01:22Z","author_association":"CONTRIBUTOR","body":"Is that a bug in the SDK?\r\nAre you getting different results when listing the contents of the bucket via aws cli for example?"}}
{"actor":{"display_login":"marcomagdy"}}