cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Olivier Goguel (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CB-3005) Argument not supported if the start page URL contains argument
Date Fri, 21 Jun 2013 10:01:20 GMT

    [ https://issues.apache.org/jira/browse/CB-3005?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13690163#comment-13690163
] 

Olivier Goguel edited comment on CB-3005 at 6/21/13 9:59 AM:
-------------------------------------------------------------

Thanks for looking at this issue : much appreciated.

Actually, there are 2 problems : 

1)the pathForResources function can't work because of the ? in the name. I've just disabled
that test for now, but it should be recoded to work with filename with parameters
2)as pathForResources does not work, it needs to be replaced by fileUrlWithPath + relativePath
(but there might be other way to do it).

Here's my quick HACK in CDDViewController.m : it could be great if something similar could
be added in an upcoming build

 if ([self.startPage rangeOfString:@"://"].location != NSNotFound) {
        appURL = [NSURL URLWithString:self.startPage];
    } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) {
        appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName,
self.startPage]];
    } else {
    // HACK : DISABLING FILE DETECTION 
        /*
        NSString* startFilePath = [self.commandDelegate pathForResource:self.startPage];
        if (startFilePath == nil) {
            loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.",
self.wwwFolderName, self.startPage];
            NSLog(@"%@", loadErr);
            self.loadFromString = YES;
            appURL = nil;
        } else {
            appURL = [NSURL fileURLWithPath:startFilePath];
            
        }
        */
        // HACK : RECONSTRUCTING PROPER URL
        NSURL *relativeURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
        NSString* localURL = [NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage];
        appURL = [NSURL URLWithString:localURL relativeToURL:relativeURL];
    }

                
      was (Author: ogoguel):
    Thanks for looking at this issue : much appreciated.

Actually, there are 2 problems : 

1)the pathForResources function can't work because of the ? in the name. I've just disabled
that test for now, but it should be recoded to work with filename with parameters
2)as pathForResources does not work, it needs to be replaced by fileUrlWithPath + relativePath
(but there might be other way to do it).

Here's my quick HACK in CDDViewController.m : it could be great if something similar could
be added in an upcoming build

 if ([self.startPage rangeOfString:@"://"].location != NSNotFound) {
        appURL = [NSURL URLWithString:self.startPage];
    } else if ([self.wwwFolderName rangeOfString:@"://"].location != NSNotFound) {
        appURL = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@", self.wwwFolderName,
self.startPage]];
    } else {
    // HACK : DISABLING FILE DETECTION 
        /*
        NSString* startFilePath = [self.commandDelegate pathForResource:self.startPage];
        if (startFilePath == nil) {
            loadErr = [NSString stringWithFormat:@"ERROR: Start Page at '%@/%@' was not found.",
self.wwwFolderName, self.startPage];
            NSLog(@"%@", loadErr);
            self.loadFromString = YES;
            appURL = nil;
        } else {
            appURL = [NSURL fileURLWithPath:startFilePath];
            
        }
        */
        // HACK : RECONSTRUCTING PROPER URL
        NSURL *relativeURL = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
        NSString* localURL = [NSString stringWithFormat:@"%@/%@", self.wwwFolderName, self.startPage];
        appURL = [NSURL URLWithString:localURL relativeToURL:relativeURL];
    }

                  
> Argument not supported if the start page URL contains argument
> --------------------------------------------------------------
>
>                 Key: CB-3005
>                 URL: https://issues.apache.org/jira/browse/CB-3005
>             Project: Apache Cordova
>          Issue Type: Bug
>          Components: iOS
>    Affects Versions: 2.5.0
>            Reporter: Olivier Goguel
>
> If the startPage contains arguments (ex: index.html?env=prod), Cordova displays "not
found error", while it is a properly formatted URL.
> Tentative Fix: use relativeToURL instead of fileURLWithPath in viewDidLoad/CDDViewController.h

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message