Skip to content

Commit 378ab23

Browse files
committedOct 3, 2017
fixed mimeUri x Spatialite and Geopackage. fixes #16296
1 parent 82dcc68 commit 378ab23

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed
 

‎python/plugins/db_manager/db_plugins/gpkg/plugin.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* *
2020
***************************************************************************/
2121
"""
22+
import re
23+
2224
from builtins import str
2325

2426
# this will disable the dbplugin if the connector raise an ImportError
@@ -189,7 +191,7 @@ def ogrUri(self):
189191
def mimeUri(self):
190192

191193
# QGIS has no provider to load Geopackage vectors, let's use OGR
192-
return u"vector:ogr:%s:%s" % (self.name, self.ogrUri())
194+
return u"vector:ogr:%s:%s" % (self.name, re.sub(":", "\:", self.ogrUri()))
193195

194196
def toMapLayer(self):
195197
from qgis.core import QgsVectorLayer

‎python/plugins/db_manager/db_plugins/spatialite/plugin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
* *
2020
***************************************************************************/
2121
"""
22+
import re
2223

2324
# this will disable the dbplugin if the connector raise an ImportError
2425
from .connector import SpatiaLiteDBConnector
@@ -183,7 +184,8 @@ def ogrUri(self):
183184
return ogrUri
184185

185186
def mimeUri(self):
186-
return Table.mimeUri(self)
187+
layerType = "raster" if self.type == Table.RasterType else "vector"
188+
return u"%s:%s:%s:%s" % (layerType, self.database().dbplugin().providerName(), self.name, re.sub(":", "\:", self.uri().uri(False)))
187189

188190
def toMapLayer(self):
189191
from qgis.core import QgsVectorLayer
@@ -268,7 +270,7 @@ def rasterliteGdalUri(self):
268270

269271
def mimeUri(self):
270272
# QGIS has no provider to load rasters, let's use GDAL
271-
uri = u"raster:gdal:%s:%s" % (self.name, self.uri().database())
273+
uri = u"raster:gdal:%s:%s" % (self.name, re.sub(":", "\:", self.uri().database()))
272274
return uri
273275

274276
def toMapLayer(self):

0 commit comments

Comments
 (0)
Please sign in to comment.