6081: Crash after double-click on .gpkg file
svn: r22643
This commit is contained in:
parent
6b8eff0908
commit
9442a5afe8
@ -336,28 +336,30 @@ class CLIDbManager(object):
|
|||||||
or (None, None) if no import was performed.
|
or (None, None) if no import was performed.
|
||||||
"""
|
"""
|
||||||
pmgr = BasePluginManager.get_instance()
|
pmgr = BasePluginManager.get_instance()
|
||||||
# Allow URL names here; make temp file if necessary
|
# check to see if it isn't a filename directly:
|
||||||
url = urlparse(filename)
|
if not os.path.isfile(filename):
|
||||||
if url.scheme != "":
|
# Allow URL names here; make temp file if necessary
|
||||||
if url.scheme == "file":
|
url = urlparse(filename)
|
||||||
filename = url2pathname(filename[7:])
|
if url.scheme != "":
|
||||||
else:
|
if url.scheme == "file":
|
||||||
url_fp = urlopen(filename) # open URL
|
filename = url2pathname(filename[7:])
|
||||||
# make a temp local file:
|
else:
|
||||||
ext = os.path.splitext(url.path)[1]
|
url_fp = urlopen(filename) # open URL
|
||||||
fd, filename = tempfile.mkstemp(suffix=ext)
|
# make a temp local file:
|
||||||
temp_fp = os.fdopen(fd, "w")
|
ext = os.path.splitext(url.path)[1]
|
||||||
# read from URL:
|
fd, filename = tempfile.mkstemp(suffix=ext)
|
||||||
data = url_fp.read()
|
temp_fp = os.fdopen(fd, "w")
|
||||||
# write locally:
|
# read from URL:
|
||||||
temp_fp.write(data)
|
data = url_fp.read()
|
||||||
url_fp.close()
|
# write locally:
|
||||||
from gen.db.dbconst import BDBVERSFN
|
temp_fp.write(data)
|
||||||
versionpath = os.path.join(name, BDBVERSFN)
|
url_fp.close()
|
||||||
_LOG.debug("Write bsddb version %s" % str(dbase.version()))
|
from gen.db.dbconst import BDBVERSFN
|
||||||
with open(versionpath, "w") as version_file:
|
versionpath = os.path.join(name, BDBVERSFN)
|
||||||
version_file.write(str(dbase.version()))
|
_LOG.debug("Write bsddb version %s" % str(dbase.version()))
|
||||||
temp_fp.close()
|
with open(versionpath, "w") as version_file:
|
||||||
|
version_file.write(str(dbase.version()))
|
||||||
|
temp_fp.close()
|
||||||
|
|
||||||
(name, ext) = os.path.splitext(os.path.basename(filename))
|
(name, ext) = os.path.splitext(os.path.basename(filename))
|
||||||
format = ext[1:].lower()
|
format = ext[1:].lower()
|
||||||
|
Loading…
Reference in New Issue
Block a user