Skip to content

Commit

Permalink
Revert "Encode the style URL in iOS (maplibre#2965)"
Browse files Browse the repository at this point in the history
This reverts commit d140d5e.
  • Loading branch information
louwers committed Nov 16, 2024
1 parent e9afa1f commit fb382b0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
5 changes: 2 additions & 3 deletions platform/darwin/src/http_file_source.mm
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,8 @@ BOOL isValidMapboxEndpoint(NSURL *url) {
MLN_APPLE_EXPORT
NSURL *resourceURL(const Resource& resource) {

NSString *encodedUrlString = [@(resource.url.c_str()) stringByAddingPercentEncodingWithAllowedCharacters:NSCharacterSet.URLQueryAllowedCharacterSet];
NSURL *url = [NSURL URLWithString:encodedUrlString];

NSURL *url = [NSURL URLWithString:@(resource.url.c_str())];

#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR
if (isValidMapboxEndpoint(url)) {
NSURLComponents *components = [NSURLComponents componentsWithURL:url resolvingAgainstBaseURL:NO];
Expand Down
11 changes: 0 additions & 11 deletions platform/darwin/test/MLNResourceTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,4 @@ - (void)testOfflineQueryParameterIsAddedForOfflineResourceForChina {
[self internalTestOfflineQueryParameterIsAddedForOfflineResource:testURL];
}

- (void)testResourceURL {
using namespace mbgl;

// Test URL with characters requiring encoding
Resource resource(Resource::Kind::Unknown, "https://example.com/test?param1=a|b&param2=c|d");
NSURL *url = resourceURL(resource);

XCTAssertNotNil(url);
XCTAssertEqualObjects(url.absoluteString, @"https://example.com/test?param1=a%7Cb&param2=c%7Cd");
}

@end

0 comments on commit fb382b0

Please sign in to comment.