[Qt-interest] Strange behaviour of QUrl::resolved() using	'file'paths
    Tony Rietwyk 
    tony.rietwyk at rightsoft.com.au
       
    Tue May 24 11:03:08 CEST 2011
    
    
  
> -----Original Message-----
> Sent: Tuesday, 24 May 2011 17:39 PM
> 
> Hi All,
> 
> I'm not sure if this is the expected behaviour or not....but the
> QUrl::resolved(QUrl &) is giving strange result when trying to merge a
> complete url with a relative one.
> 
> Eg:
> 
> QUrl baseUrl("/home/mandeep/urltest");
> qDebug() << "Base url is" << baseUrl.toString();
> QUrl res = baseUrl.resolved(QUrl("../bin"));
> qDebug() << "Resolved url=" << res.toString();
> 
> This gives the following output:
> 
> Base url is "/home/mandeep/urltest"
> Resolved url= "/home/bin"
> 
> Shouldn't the resolved url have been /home/mandeep/bin (since I'm
> doing "../bin").
> However, if I set the relative url to "./bin" (single dot before
> slash), it gives:
> 
> Resolved url= "/home/mandeep/bin"
> 
> Is this expected? I thought the "../" notation worked similar to how
> 'cd' interprets it...i.e "1 level up".
> 
> Thanks,
> -mandeep
Hi, 
How can QUrl know whether urltest is a folder or a file with no dots in its
name?  It seems to assume it is a file.  Try adding a slash to the end of
the baseUrl, ie QUrl baseUrl("/home/mandeep/urltest/");
I've stumbled upon a similar problem recently setting up an Apache server as
reverse proxy to my Qt http service.  Without a terminating slash on the
path to be proxied in the configuration, I would get TWO slashes at the
start of the path in the proxied request!  
Hope that helps, 
Tony.
    
    
More information about the Qt-interest-old
mailing list