(fix) handle URI in vCard photos (fixes #2683)
This commit is contained in:
parent
6cd3d90410
commit
239dffa391
|
@ -40,25 +40,34 @@
|
||||||
- (id) GETAction: (WOContext *) localContext
|
- (id) GETAction: (WOContext *) localContext
|
||||||
{
|
{
|
||||||
NGVCardPhoto *photo;
|
NGVCardPhoto *photo;
|
||||||
|
NSString *uri;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
id response;
|
id response;
|
||||||
|
|
||||||
photo = [self photo];
|
photo = [self photo];
|
||||||
|
data = nil;
|
||||||
|
uri = nil;
|
||||||
|
|
||||||
if ([photo isInline])
|
if ([photo isInline])
|
||||||
data = [photo decodedContent];
|
data = [photo decodedContent];
|
||||||
else
|
else if ([[photo value: 0 ofAttribute: @"value"] isEqualToString: @"uri"])
|
||||||
data = [[photo flattenedValuesForKey: @""]
|
uri = [photo flattenedValuesForKey: @""];
|
||||||
dataUsingEncoding: NSISOLatin1StringEncoding];
|
|
||||||
if (data)
|
if (data)
|
||||||
{
|
{
|
||||||
response = [localContext response];
|
response = [localContext response];
|
||||||
|
|
||||||
[response setHeader: [self davContentType] forKey: @"content-type"];
|
[response setHeader: [self davContentType] forKey: @"content-type"];
|
||||||
[response setHeader: [NSString stringWithFormat:@" %d",
|
[response setHeader: [NSString stringWithFormat:@" %d",
|
||||||
(int)[data length]]
|
(int)[data length]]
|
||||||
forKey: @"content-length"];
|
forKey: @"content-length"];
|
||||||
[response setContent: data];
|
[response setContent: data];
|
||||||
}
|
}
|
||||||
|
else if (uri)
|
||||||
|
{
|
||||||
|
response = [localContext response];
|
||||||
|
[response setStatus: 302];
|
||||||
|
[response setHeader: uri forKey: @"location"];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
response = nil;
|
response = nil;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue