Committed by
Ben Copsey
Fixed bug in Object request for using subResource by adding ivar and a little code
Showing
2 changed files
with
9 additions
and
0 deletions
| @@ -27,6 +27,8 @@ | @@ -27,6 +27,8 @@ | ||
| 27 | // Set this if having the correct mime type returned to you when you GET the data is important (eg it will be served by a web-server) | 27 | // Set this if having the correct mime type returned to you when you GET the data is important (eg it will be served by a web-server) |
| 28 | // Can be autodetected when PUTing a file from disk, will default to 'application/octet-stream' when PUTing data | 28 | // Can be autodetected when PUTing a file from disk, will default to 'application/octet-stream' when PUTing data |
| 29 | NSString *mimeType; | 29 | NSString *mimeType; |
| 30 | + | ||
| 31 | + NSString* subResource; | ||
| 30 | } | 32 | } |
| 31 | 33 | ||
| 32 | // Create a request, building an appropriate url | 34 | // Create a request, building an appropriate url |
| @@ -63,5 +65,6 @@ | @@ -63,5 +65,6 @@ | ||
| 63 | @property (retain) NSString *sourceBucket; | 65 | @property (retain) NSString *sourceBucket; |
| 64 | @property (retain) NSString *sourceKey; | 66 | @property (retain) NSString *sourceKey; |
| 65 | @property (retain) NSString *mimeType; | 67 | @property (retain) NSString *mimeType; |
| 68 | +@property (retain) NSString *subResource; | ||
| 66 | 69 | ||
| 67 | @end | 70 | @end |
| @@ -32,6 +32,7 @@ | @@ -32,6 +32,7 @@ | ||
| 32 | { | 32 | { |
| 33 | NSString *path = [ASIS3Request stringByURLEncodingForS3Path:key]; | 33 | NSString *path = [ASIS3Request stringByURLEncodingForS3Path:key]; |
| 34 | ASIS3ObjectRequest *request = [[[self alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.s3.amazonaws.com%@?%@",bucket,path,subResource]]] autorelease]; | 34 | ASIS3ObjectRequest *request = [[[self alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://%@.s3.amazonaws.com%@?%@",bucket,path,subResource]]] autorelease]; |
| 35 | + request.subResource = subResource; | ||
| 35 | [request setBucket:bucket]; | 36 | [request setBucket:bucket]; |
| 36 | [request setKey:key]; | 37 | [request setKey:key]; |
| 37 | return request; | 38 | return request; |
| @@ -114,6 +115,9 @@ | @@ -114,6 +115,9 @@ | ||
| 114 | 115 | ||
| 115 | - (NSString *)canonicalizedResource | 116 | - (NSString *)canonicalizedResource |
| 116 | { | 117 | { |
| 118 | + if ([self.subResource length] > 0) | ||
| 119 | + return [NSString stringWithFormat:@"/%@%@?%@",[self bucket],[ASIS3Request stringByURLEncodingForS3Path:[self key]], self.subResource]; | ||
| 120 | + | ||
| 117 | return [NSString stringWithFormat:@"/%@%@",[self bucket],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]; | 121 | return [NSString stringWithFormat:@"/%@%@",[self bucket],[ASIS3Request stringByURLEncodingForS3Path:[self key]]]; |
| 118 | } | 122 | } |
| 119 | 123 | ||
| @@ -143,4 +147,6 @@ | @@ -143,4 +147,6 @@ | ||
| 143 | @synthesize sourceBucket; | 147 | @synthesize sourceBucket; |
| 144 | @synthesize sourceKey; | 148 | @synthesize sourceKey; |
| 145 | @synthesize mimeType; | 149 | @synthesize mimeType; |
| 150 | +@synthesize subResource; | ||
| 151 | + | ||
| 146 | @end | 152 | @end |
-
Please register or login to post a comment