Make the scheme and path prefix optional

This commit is contained in:
Richard Ramos 2020-09-30 14:45:28 -04:00 committed by Michał
parent c6081720e7
commit edb4b79e1b
1 changed files with 10 additions and 2 deletions

View File

@ -1162,8 +1162,16 @@ char *dos_qurl_host(char* url)
char *dos_qurl_replaceHostAndAddPath(char* url, char* newScheme, char* newHost, char* pathPrefix)
{
auto newQurl = QUrl(QString(url));
newQurl.setScheme(newScheme);
newQurl.setHost(newHost);
newQurl.setPath(QString(pathPrefix) + newQurl.path());
if(QString(newScheme).compare("") != 0){
newQurl.setScheme(newScheme);
}
if (QString(pathPrefix).compare("") != 0){
newQurl.setPath(QString(pathPrefix) + newQurl.path());
}
return convert_to_cstring(newQurl.toString());
}