Skip to content

Commit

Permalink
Fix bug #6582: QGIS server displayes text layers only with absolute p…
Browse files Browse the repository at this point in the history
…athes
  • Loading branch information
mhugent committed Nov 7, 2012
1 parent e15f4a8 commit 5f19c6b
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/mapserver/qgsprojectparser.cpp
Expand Up @@ -41,6 +41,7 @@
#include <QSvgRenderer>
#include <QTextDocument>
#include "QTextStream"
#include <QUrl>


QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
Expand Down Expand Up @@ -1305,6 +1306,24 @@ QgsMapLayer* QgsProjectParser::createLayerFromElement( const QDomElement& elem,
}
}
}
else if ( uri.startsWith( "file:" ) ) //a file based datasource in url notation (e.g. delimited text layer)
{
QString filePath = uri.mid( 5, uri.indexOf( "?" ) - 5 );
QString absoluteFilePath = convertToAbsolutePath( filePath );
if ( filePath != absoluteFilePath )
{
QUrl destUrl = QUrl::fromEncoded( uri.toAscii() );
destUrl.setScheme( "file" );
destUrl.setPath( absoluteFilePath );
absoluteUri = destUrl.toEncoded();
QDomText absoluteTextNode = mXMLDoc->createTextNode( absoluteUri );
dataSourceElem.replaceChild( absoluteTextNode, dataSourceElem.firstChild() );
}
else
{
absoluteUri = uri;
}
}
else //file based data source
{
absoluteUri = convertToAbsolutePath( uri );
Expand Down

0 comments on commit 5f19c6b

Please sign in to comment.