You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/12/11 21:54:15 UTC

cordova-plugins git commit: CB-8032 - assets-library url transform fix.

Repository: cordova-plugins
Updated Branches:
  refs/heads/master 98e47a045 -> b52ca7396


CB-8032 - assets-library url transform fix.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/b52ca739
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/b52ca739
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/b52ca739

Branch: refs/heads/master
Commit: b52ca7396afc2b9e9c9245d1d5e36f169fd51658
Parents: 98e47a0
Author: Shazron Abdullah <sh...@apache.org>
Authored: Thu Dec 11 12:54:13 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Thu Dec 11 12:54:13 2014 -0800

----------------------------------------------------------------------
 local-webserver/src/ios/CDVLocalWebServer.m | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/b52ca739/local-webserver/src/ios/CDVLocalWebServer.m
----------------------------------------------------------------------
diff --git a/local-webserver/src/ios/CDVLocalWebServer.m b/local-webserver/src/ios/CDVLocalWebServer.m
index e067176..6323679 100644
--- a/local-webserver/src/ios/CDVLocalWebServer.m
+++ b/local-webserver/src/ios/CDVLocalWebServer.m
@@ -66,11 +66,13 @@
 		NSString* authToken = [NSString stringWithFormat:@"cdvToken=%@", [[NSProcessInfo processInfo] globallyUniqueString]];
         
         [self addAppFileSystemHandler:authToken basePath:[NSString stringWithFormat:@"/%@/", appBasePath] indexPage:indexPage];
-        [self addFileSystemHandlers:authToken];
         
         [self.server startWithPort:port bonjourName:nil];
         [GCDWebServer setLogLevel:kGCDWebServerLoggingLevel_Error];
         
+        // add after server is started to get the true port
+        [self addFileSystemHandlers:authToken];
+        
         // Update the startPage (supported in cordova-ios 3.7.0, see https://issues.apache.org/jira/browse/CB-7857)
 		vc.startPage = [NSString stringWithFormat:@"http://localhost:%lu/%@/%@?%@", (unsigned long)self.server.port, appBasePath, indexPage, authToken];
         
@@ -95,14 +97,15 @@
             NSString* localhostUrlString = [NSString stringWithFormat:@"http://localhost:%lu", [localServerURL.port unsignedIntegerValue]];
             
             if ([[urlToTransform scheme] isEqualToString:ASSETS_LIBRARY_PATH]) {
-                transformedUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@/%@",
+                transformedUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@/%@%@",
                         localhostUrlString,
                         ASSETS_LIBRARY_PATH,
+                        urlToTransform.host,
                         urlToTransform.path
                         ]];
 
             } else if ([[urlToTransform scheme] isEqualToString:@"file"]) {
-                transformedUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@/%@",
+                transformedUrl = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@%@",
                        localhostUrlString,
                         LOCAL_FILESYSTEM_PATH,
                        urlToTransform.path


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org