Revision 45f2fce6 Classes/StorageObject.m

b/Classes/StorageObject.m
54 54
#pragma mark JSON
55 55

  
56 56
+ (StorageObject *)fromJSON:(NSDictionary *)dict {
57
    
58 57
    StorageObject *object = [[[StorageObject alloc] init] autorelease];
59 58
    
60 59
    object.name = [dict objectForKey:@"name"]; // this may be shortened by folder parsing later
......
65 64
    object.lastModified = [ComputeModel dateFromString:[dict objectForKey:@"last_modified"]];
66 65
    object.publicURI = [dict objectForKey:@"x_object_public"];
67 66
    object.sharing = [dict objectForKey:@"x_object_sharing"];
68
        
67
    
69 68
    object.metadata = [NSMutableDictionary dictionary];
70
    for (NSString *key in dict) {
71
        if ([key hasPrefix:@"x_object_meta_"]) {
72
            NSString *metadataKey = [key substringFromIndex:14];
73
            [object.metadata setObject:[dict objectForKey:key] forKey:metadataKey];
69
    if ([dict objectForKey:@"x_object_meta"]) {
70
        NSDictionary *metadata = [dict objectForKey:@"x_object_meta"];
71
        for (NSString *metadataKey in metadata) {
72
            NSString *metadataValue = [metadata objectForKey:metadataKey];
73
            [object.metadata setObject:metadataKey forKey:metadataValue];
74 74
        }
75 75
    }
76 76
        

Also available in: Unified diff