Skip to content

Commit 9c8475e

Browse files
committed
Add safeguard for -of option
1 parent 7c15374 commit 9c8475e

File tree

1 file changed

+6
-1
lines changed
  • python/plugins/processing/algs/gdal

1 file changed

+6
-1
lines changed

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,13 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):
226226

227227
out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
228228
self.setOutputValue(self.OUTPUT, out)
229+
230+
output_format = QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1])
231+
if not output_format:
232+
raise QgsProcessingException(self.tr('Output format is invalid'))
233+
229234
arguments.append('-of')
230-
arguments.append(QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1]))
235+
arguments.append(output_format)
231236

232237
options = self.parameterAsString(parameters, self.OPTIONS, context)
233238
if options:

0 commit comments

Comments
 (0)