Skip to content

Commit 5719fec

Browse files
committed
[processing] fix substitution of the original layers in GDAL commands
(cherry picked from commit 89774ab)
1 parent 769fe65 commit 5719fec

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python/plugins/processing/algs/gdal/GdalAlgorithm.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
__revision__ = '$Format:%H$'
2727

2828
import os
29+
import re
2930

3031
from qgis.PyQt.QtGui import QIcon
3132

@@ -58,7 +59,9 @@ def processAlgorithm(self, progress):
5859
c = c.replace(layer.source(), exported)
5960
if os.path.isfile(layer.source()):
6061
fileName = os.path.splitext(os.path.split(layer.source())[1])[0]
61-
c = c.replace(' ' + fileName + ' ', ' ' + exportedFileName + ' ')
62+
c = re.sub('[\s]{}[\s]'.format(fileName), ' ' + exportedFileName + ' ', c)
63+
c = re.sub('[\s]{}'.format(fileName), ' ' + exportedFileName, c)
64+
c = re.sub('["\']{}["\']'.format(fileName), "'" + exportedFileName + "'", c)
6265

6366
commands[i] = c
6467
GdalUtils.runGdal(commands, progress)

0 commit comments

Comments
 (0)