ObjFW  Check-in [334db394f3]

Overview
Comment:OFArchiveIRIHandler: Use the rightmost `!`

This allows chaining several of these without the need to quote the `!`.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 334db394f313747e79fff6b6af24a14611c478ac6df68885dc42e348c49ea7cd
User & Date: js on 2024-03-04 22:26:41
Other Links: manifest | tags
Context
2024-03-04
22:54
ofhash: Add --iri option check-in: ac8ca0f430 user: js tags: trunk
22:26
OFArchiveIRIHandler: Use the rightmost `!` check-in: 334db394f3 user: js tags: trunk
01:21
Rename schemes for archive IRI handlers back check-in: 34a3e817b3 user: js tags: trunk
Changes

Modified src/OFArchiveIRIHandler.m from [78d87309e9] to [933f97fec8].

77
78
79
80
81
82
83
84



85
86
87
88
89
90
91
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91
92
93







-
+
+
+







							  IRI.path]
						mode: mode];
		stream = [OFGZIPStream streamWithStream: stream mode: mode];
		goto end;
	}

	percentEncodedPath = IRI.percentEncodedPath;
	pos = [percentEncodedPath rangeOfString: @"!"].location;
	pos = [percentEncodedPath
	    rangeOfString: @"!"
		  options: OFStringSearchBackwards].location;

	if (pos == OFNotFound)
		@throw [OFInvalidArgumentException exception];

	archiveIRI = [OFIRI IRIWithString:
	    [percentEncodedPath substringWithRange: OFMakeRange(0, pos)]
	    .stringByRemovingPercentEncoding];
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210

211
212
213
214
215
216
193
194
195
196
197
198
199

200
201
202
203
204
205



206
207

208
209
210
211
212
213
214







-






-
-
-


-
+






OFIRI *
OFArchiveIRIHandlerIRIForFileInArchive(OFString *scheme,
    OFString *pathInArchive, OFIRI *archiveIRI)
{
	static OFOnceControl onceControl = OFOnceControlInitValue;
	OFMutableIRI *ret = [OFMutableIRI IRIWithScheme: scheme];
	void *pool = objc_autoreleasePoolPush();
	OFString *archiveIRIString;

	OFOnce(&onceControl, initPathAllowedCharacters);

	pathInArchive = [pathInArchive
	    stringByAddingPercentEncodingWithAllowedCharacters:
	    pathAllowedCharacters];
	archiveIRIString = [archiveIRI.string
	    stringByAddingPercentEncodingWithAllowedCharacters:
	    pathAllowedCharacters];

	ret.percentEncodedPath = [OFString
	    stringWithFormat: @"%@!%@", archiveIRIString, pathInArchive];
	    stringWithFormat: @"%@!%@", archiveIRI.string, pathInArchive];
	[ret makeImmutable];

	objc_autoreleasePoolPop(pool);

	return ret;
}