BTHLABS-58: Fixing URL paths resolution to avoid double slashes
This commit is contained in:
parent
9ab2b304b8
commit
cb001f7e91
|
@ -10,6 +10,7 @@
|
||||||
#import "HPAPI.h"
|
#import "HPAPI.h"
|
||||||
#import "HPCredentialsHelper.h"
|
#import "HPCredentialsHelper.h"
|
||||||
#import "HPRPCClient.h"
|
#import "HPRPCClient.h"
|
||||||
|
#import "NSURL+HotPocketExtensions.h"
|
||||||
|
|
||||||
@implementation HPAuthParams
|
@implementation HPAuthParams
|
||||||
|
|
||||||
|
@ -26,15 +27,14 @@
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSURL *authURL = [self.baseURL URLByAppendingPathComponent:@"/integrations/extension/authenticate/"];
|
if (self.baseURL.isUsableInHotPocket == NO) {
|
||||||
|
|
||||||
if (authURL.scheme == nil) {
|
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||||
|
|
||||||
NSURLComponents *authURLComponents = [NSURLComponents componentsWithURL:authURL resolvingAgainstBaseURL:NO];
|
NSURLComponents *authURLComponents = [NSURLComponents componentsWithURL:self.baseURL resolvingAgainstBaseURL:NO];
|
||||||
|
authURLComponents.path = @"/integrations/extension/authenticate/";
|
||||||
authURLComponents.queryItems = @[
|
authURLComponents.queryItems = @[
|
||||||
[NSURLQueryItem queryItemWithName:@"source" value:[[mainBundle infoDictionary] valueForKey:@"HPAuthFlowSource"]],
|
[NSURLQueryItem queryItemWithName:@"source" value:[[mainBundle infoDictionary] valueForKey:@"HPAuthFlowSource"]],
|
||||||
[NSURLQueryItem queryItemWithName:@"session_token" value:self.sessionToken],
|
[NSURLQueryItem queryItemWithName:@"session_token" value:self.sessionToken],
|
||||||
|
|
|
@ -96,7 +96,8 @@
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:[self.baseURL URLByAppendingPathComponent:endpoint] resolvingAgainstBaseURL:NO];
|
NSURLComponents *urlComponents = [NSURLComponents componentsWithURL:self.baseURL resolvingAgainstBaseURL:NO];
|
||||||
|
urlComponents.path = endpoint;
|
||||||
urlComponents.queryItems = @[
|
urlComponents.queryItems = @[
|
||||||
[NSURLQueryItem queryItemWithName:@"method" value:method],
|
[NSURLQueryItem queryItemWithName:@"method" value:method],
|
||||||
];
|
];
|
||||||
|
|
|
@ -6,17 +6,17 @@
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionAttributes</key>
|
<key>NSExtensionAttributes</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionJavaScriptPreprocessingFile</key>
|
|
||||||
<string>ShareExtensionHelper</string>
|
|
||||||
<key>NSExtensionActivationRule</key>
|
<key>NSExtensionActivationRule</key>
|
||||||
<dict>
|
<dict>
|
||||||
|
<key>NSExtensionActivationSupportsText</key>
|
||||||
|
<true/>
|
||||||
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
|
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>NSExtensionActivationSupportsText</key>
|
|
||||||
<true/>
|
|
||||||
</dict>
|
</dict>
|
||||||
|
<key>NSExtensionJavaScriptPreprocessingFile</key>
|
||||||
|
<string>ShareExtensionHelper</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSExtensionMainStoryboard</key>
|
<key>NSExtensionMainStoryboard</key>
|
||||||
<string>MainInterface</string>
|
<string>MainInterface</string>
|
||||||
|
|
|
@ -7,19 +7,19 @@
|
||||||
<key>NSExtension</key>
|
<key>NSExtension</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionAttributes</key>
|
<key>NSExtensionAttributes</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSExtensionJavaScriptPreprocessingFile</key>
|
<key>NSExtensionActivationRule</key>
|
||||||
<string>ShareExtensionHelper</string>
|
<dict>
|
||||||
<key>NSExtensionActivationRule</key>
|
<key>NSExtensionActivationSupportsText</key>
|
||||||
<dict>
|
<true/>
|
||||||
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
|
<key>NSExtensionActivationSupportsWebPageWithMaxCount</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
<key>NSExtensionActivationSupportsWebURLWithMaxCount</key>
|
||||||
<integer>1</integer>
|
<integer>1</integer>
|
||||||
<key>NSExtensionActivationSupportsText</key>
|
</dict>
|
||||||
<true/>
|
<key>NSExtensionJavaScriptPreprocessingFile</key>
|
||||||
</dict>
|
<string>ShareExtensionHelper</string>
|
||||||
</dict>
|
</dict>
|
||||||
<key>NSExtensionPointIdentifier</key>
|
<key>NSExtensionPointIdentifier</key>
|
||||||
<string>com.apple.share-services</string>
|
<string>com.apple.share-services</string>
|
||||||
<key>NSExtensionPrincipalClass</key>
|
<key>NSExtensionPrincipalClass</key>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user