diff --git a/Network/AWS/S3Bucket.hs b/Network/AWS/S3Bucket.hs index 336cd44..3eab062 100644 --- a/Network/AWS/S3Bucket.hs +++ b/Network/AWS/S3Bucket.hs @@ -219,6 +219,9 @@ data ListResult = etag :: String, -- ^ MD5 size :: Integer, -- ^ Bytes of object data storageClass :: StorageClass -- ^ Storage class of the object + } + | CommonPrefix { + keyPrefix :: String } deriving (Show) -- | Is a result set response truncated? @@ -291,13 +294,17 @@ getListResults :: String -> IO [ListResult] getListResults s = runX (readString [withValidate no] s >>> processListResults) processListResults :: ArrowXml a => a (Data.Tree.NTree.TypeDefs.NTree XNode) ListResult -processListResults = deep (isElem >>> hasName "Contents") >>> +processListResults = (deep (isElem >>> hasName "Contents") >>> ((text <<< atTag "Key") &&& (text <<< atTag "LastModified") &&& (text <<< atTag "ETag") &&& (text <<< atTag "Size") &&& (text <<< atTag "StorageClass")) >>> - arr (\(a,(b,(c,(d,e)))) -> ListResult a b ((unquote . HTTP.urlDecode) c) (read d) (read e)) + arr (\(a,(b,(c,(d,e)))) -> ListResult a b ((unquote . HTTP.urlDecode) c) (read d) (read e))) + <+> + (deep (isElem >>> hasName "CommonPrefixes") >>> + (text <<< atTag "Prefix") >>> + arr (\a -> CommonPrefix a)) -- | Check Amazon guidelines on bucket naming. (missing test for IP-like names) isBucketNameValid :: String -> Bool diff --git a/hS3.cabal b/hS3.cabal index e8a0595..ce4cc87 100644 --- a/hS3.cabal +++ b/hS3.cabal @@ -1,5 +1,5 @@ Name: hS3 -Version: 0.5.9 +Version: 0.5.10 License: BSD3 License-file: LICENSE Cabal-Version: >= 1.6