@@ -131,7 +131,7 @@ module.exports = CoreObject.extend({
131131 current : headObject ( client , { Bucket : bucket , Key : indexKey } ) ,
132132 } )
133133 . then ( function ( data ) {
134- return data . revisions . All . sort ( function ( a , b ) {
134+ return data . revisions . sort ( function ( a , b ) {
135135 return new Date ( b . LastModified ) - new Date ( a . LastModified ) ;
136136 } ) . map ( function ( d ) {
137137 var revision = d . Key . substr ( revisionPrefix . length ) ;
@@ -146,24 +146,21 @@ module.exports = CoreObject.extend({
146146 var listObjects = RSVP . denodeify ( client . listObjects . bind ( client ) ) ;
147147 var allRevisions = [ ] ;
148148
149- return new Promise ( function ( resolve , reject ) {
150- function listObjectRecursively ( options ) {
151- listObjects ( options ) . then ( function ( response ) {
152- [ ] . push . apply ( allRevisions , response . Contents ) ;
153-
154- if ( response . IsTruncated ) {
155- var nextMarker = response . NextMarker || response . Contents [ response . Contents . length - 1 ] . Key ;
156- options . Marker = nextMarker ;
157- listObjectRecursively ( options ) ;
158- } else {
159- response . All = allRevisions ;
160- resolve ( response ) ;
161- }
162- } ) . catch ( reject ) ;
163- }
149+ function listObjectRecursively ( options ) {
150+ return listObjects ( options ) . then ( function ( response ) {
151+ [ ] . push . apply ( allRevisions , response . Contents ) ;
164152
165- listObjectRecursively ( options ) ;
166- } ) ;
153+ if ( response . IsTruncated ) {
154+ var nextMarker = response . Contents [ response . Contents . length - 1 ] . Key ;
155+ options . Marker = nextMarker ;
156+ return listObjectRecursively ( options ) ;
157+ } else {
158+ return allRevisions ;
159+ }
160+ } ) ;
161+ }
162+
163+ return listObjectRecursively ( options ) ;
167164
168165 }
169166} ) ;
0 commit comments