643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
|
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
|
-
+
-
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
|
[OFCharacterSet URLQueryAllowedCharacterSet]);
}
if (*UTF8String == '/')
_URLEncodedPath = [[OFString alloc]
initWithUTF8String: UTF8String];
else {
OFString *path, *s;
OFString *relativePath =
path = [OFString stringWithUTF8String: UTF8String];
[OFString stringWithUTF8String: UTF8String];
if ([URL->_URLEncodedPath hasSuffix: @"/"])
s = [URL->_URLEncodedPath
stringByAppendingString: path];
else
s = [OFString stringWithFormat:
@"%@/../%@", URL->_URLEncodedPath, path];
_URLEncodedPath = [[URL->_URLEncodedPath
stringByAppendingString: relativePath]
copy];
else {
OFMutableString *path = [OFMutableString
stringWithString:
(URL->_URLEncodedPath != nil
? URL->_URLEncodedPath
: @"/")];
of_range_t range = [path
rangeOfString: @"/"
options: OF_STRING_SEARCH_BACKWARDS];
if (range.location == OF_NOT_FOUND)
@throw [OFInvalidFormatException
exception];
range.location++;
range.length = [path length] - range.location;
[path replaceCharactersInRange: range
withString: relativePath];
[path makeImmutable];
_URLEncodedPath =
_URLEncodedPath = [path copy];
[[s stringByStandardizingURLPath] copy];
}
}
of_url_verify_escaped(_URLEncodedPath,
[OFCharacterSet URLPathAllowedCharacterSet]);
objc_autoreleasePoolPop(pool);
} @catch (id e) {
|