mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Fix bug #6582: QGIS server displayes text layers only with absolute pathes
This commit is contained in:
parent
e15f4a8383
commit
5f19c6b319
@ -41,6 +41,7 @@
|
||||
#include <QSvgRenderer>
|
||||
#include <QTextDocument>
|
||||
#include "QTextStream"
|
||||
#include <QUrl>
|
||||
|
||||
|
||||
QgsProjectParser::QgsProjectParser( QDomDocument* xmlDoc, const QString& filePath ): QgsConfigParser(), mXMLDoc( xmlDoc ), mProjectPath( filePath )
|
||||
@ -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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user