Skip to content

Commit ce34641

Browse files
committed
remove leading dir separator from symbol path when it's relative,
SLD: remove file schema from OnlineResource tag's path
1 parent b399c1e commit ce34641

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

src/core/symbology-ng/qgssymbollayerv2utils.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2301,18 +2301,11 @@ bool QgsSymbolLayerV2Utils::functionFromSldElement( QDomElement &element, QStrin
23012301
void QgsSymbolLayerV2Utils::createOnlineResourceElement( QDomDocument &doc, QDomElement &element,
23022302
QString path, QString format )
23032303
{
2304-
QString relpath = symbolPathToName( path );
2305-
2306-
// convert image path to url
2307-
QUrl url( relpath );
2308-
if ( !url.isValid() || url.scheme().isEmpty() )
2309-
{
2310-
url.setUrl( QUrl::fromLocalFile( relpath ).toString() );
2311-
}
2312-
2304+
// get resource url or relative path
2305+
QString url = symbolPathToName( path );
23132306
QDomElement onlineResourceElem = doc.createElement( "se:OnlineResource" );
23142307
onlineResourceElem.setAttribute( "xlink:type", "simple" );
2315-
onlineResourceElem.setAttribute( "xlink:href", url.toString() );
2308+
onlineResourceElem.setAttribute( "xlink:href", url );
23162309
element.appendChild( onlineResourceElem );
23172310

23182311
QDomElement formatElem = doc.createElement( "se:Format" );
@@ -2945,7 +2938,7 @@ QString QgsSymbolLayerV2Utils::symbolPathToName( QString path )
29452938

29462939
if ( !dir.isEmpty() && path.startsWith( dir ) )
29472940
{
2948-
path = path.mid( dir.size() );
2941+
path = path.mid( dir.size() + 1 );
29492942
isInSvgPathes = true;
29502943
break;
29512944
}

0 commit comments

Comments
 (0)