From 8c0c4883d0683a43e354d6f5455eea93e71747a6 Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 8 Oct 2004 12:48:57 +0000 Subject: [PATCH] minor url optimization git-svn-id: http://svn.opengroupware.org/SOPE/trunk@233 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 3 +++ sope-appserver/NGObjWeb/Version | 2 +- .../NGObjWeb/WebDAV/SoObjectDataSource.m | 22 ++++++++++++++----- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 546a8062..4313bbe8 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,5 +1,8 @@ 2004-10-08 Helge Hess + * WebDAV/SoObjectDataSource.m: minor optimization to URL generation + (v4.3.56) + * v4.3.55 * WebDAV/SoObjectResultEntry.m, WebDAV/SoWebDAVRenderer.m: improved diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 178036b2..ccd73ff0 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=55 +SUBMINOR_VERSION:=56 # v4.3.42 requires libNGExtensions v4.3.116 # v4.3.40 requires libNGExtensions v4.3.115 diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m index ba757313..477ab3d7 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectDataSource.m @@ -24,6 +24,8 @@ #include "SoObject+SoDAV.h" #include "SoObject.h" #include "EOFetchSpecification+SoDAV.h" +#include +#include #include #include #include "common.h" @@ -97,10 +99,21 @@ static BOOL debugOn = NO; NSArray *queriedAttrNames; NSArray *orderings; NSString *childKey; - NSString *tmp; + BOOL doEscape; + NSString *entityURL; BOOL isBrief = YES; // do not encode "sub-errors", just omit the item [self debugWithFormat:@"performing flat query: %@", _fs]; + + /* base URL */ + + entityURL = [_fs entityName]; + if (![entityURL hasSuffix:@"/"]) + entityURL = [entityURL stringByAppendingString:@"/"]; + + doEscape = YES; + + /* retrieve child names (calls -toOneRelationshipKeys and -toManyRel...) */ childKeys = [self->object davChildKeysInContext:_ctx]; @@ -185,11 +198,8 @@ static BOOL debugOn = NO; Note: we cannot use NSPathUtilities, those will reformat the string on Cocoa Foundation! (eg http://a => http:/a, remove double slashes) */ - childHref = [childKey stringByEscapingURL]; - tmp = [_fs entityName]; - if (![tmp hasSuffix:@"/"]) - tmp = [tmp stringByAppendingString:@"/"]; - childHref = [tmp stringByAppendingString:childHref]; + childHref = doEscape ? [childKey stringByEscapingURL] : childKey; + childHref = [entityURL stringByAppendingString:childHref]; if (debugOn) { // TODO: this happens if we access using Goliath -- 2.39.5