Revision 133b1f2d pithos-macos/PithosFileUtilities.m

b/pithos-macos/PithosFileUtilities.m
618 618
        objectNamePrefix = [objectNamePrefix substringToIndex:([objectNamePrefix length] - 1)];
619 619
        objectNameExtraSuffix = [NSString stringWithString:@"/"];
620 620
    }
621
    NSArray *objects = [self objectsWithContainerName:containerName objectNamePrefix:objectNamePrefix delimiter:nil];
621
    NSArray *objects = [self objectsWithContainerName:containerName 
622
                                     objectNamePrefix:[objectNamePrefix stringByDeletingLastPathComponent] 
623
                                            delimiter:@"/"];
622 624
    if (objects == nil)
623 625
        return nil;
624 626
    if ([objects count] == 0)
625 627
        return objectName;
626
    NSArray *objectNames = [objects valueForKey:@"name"];
628
    NSMutableArray *objectNames = [NSMutableArray arrayWithArray:
629
                                   [[objects objectsAtIndexes:
630
                                     [objects indexesOfObjectsPassingTest:^(ASIPithosObject *pithosObject, NSUInteger idx, BOOL *stop){
631
        if (pithosObject.subdir)
632
            return NO;
633
        return YES;
634
    }]] valueForKey:@"name"]];
635
    for (NSString *name in [[objects objectsAtIndexes:
636
                             [objects indexesOfObjectsPassingTest:^(ASIPithosObject *pithosObject, NSUInteger idx, BOOL *stop){
637
        if (pithosObject.subdir)
638
            return YES;
639
        return NO;
640
    }]] valueForKey:@"name"]) {
641
        [objectNames addObject:[name substringToIndex:([name length] - 1)]];
642
    }
627 643
    if (![objectNames containsObject:objectName])
628 644
        return objectName;
629 645
    NSUInteger objectNameSuffix = 1;

Also available in: Unified diff