Skip to content

Commit a968fa3

Browse files
committed
[processing] use original filename when possible when exporting vector layer
Conflicts: python/plugins/processing/tools/dataobjects.py
1 parent c65cc92 commit a968fa3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

python/plugins/processing/tools/dataobjects.py

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from processing.algs.gdal.GdalUtils import GdalUtils
4848
from processing.tools.system import (getTempFilenameInTempFolder,
4949
getTempFilename,
50+
removeInvalidChars
5051
isWindows)
5152

5253
ALL_TYPES = [-1]
@@ -311,6 +312,13 @@ def exportVectorLayer(layer, supported=None):
311312
systemEncoding = settings.value('/UI/encoding', 'System')
312313

313314
output = getTempFilename('shp')
315+
basename = removeInvalidChars(os.path.basename(layer.source()))
316+
if basename:
317+
if not basename.endswith("shp"):
318+
basename = basename + ".shp"
319+
output = getTempFilenameInTempFolder(basename)
320+
else:
321+
output = getTempFilename("shp")
314322
provider = layer.dataProvider()
315323
useSelection = ProcessingConfig.getSetting(ProcessingConfig.USE_SELECTED)
316324
if useSelection and layer.selectedFeatureCount() != 0:

0 commit comments

Comments
 (0)