Paul Mietz Egli
unread,Nov 3, 2010, 1:22:27 PM11/3/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ASIHTTPRequest
I have buckets that are named with an ISO timestamp (i.e.
"2010-11-03T10:12:00-0700") and am listing the contents as follows:
ASIS3BucketRequest *listRequest = [ASIS3BucketRequest
requestWithBucket:@"my-bucket-name"];
[listRequest setPrefix:@"foo/2010-11-03T10:12:00-0700"];
[listRequest setDelimiter:@"/"];
[listRequest startSynchronous];
This works fine for the timestamp shown above, but list requests for
prefixes that have timestamps containing a plus character (for
example, "2010-20-03T10:12:00+0200") return no objects. The problem
lies in [ASIS3BucketRequest createQueryString] -- the call to
[NSString
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding] does
not encode the plus symbol correctly, so S3 is treating it as a space
character in the URL. If I try to pre-encoding the plus to "%2B"
before I call setPrefix, the percent sign of "%2B" gets encoded in
createQueryString, so that doesn't work.
The workaround that I've found is to change createQueryString to
manually encode the plus signs as follows:
[queryParts addObject:[NSString stringWithFormat:@"prefix=%@",[[[self
prefix]
stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"]]];
I'm not terribly happy with this, but I wanted to bring it up in case
anyone else ran into this issue.
p.