Skip to content

Commit

Permalink
Add safeguard for -of option
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Oct 2, 2023
1 parent 6e3364f commit 7bf5cc7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python/plugins/processing/algs/gdal/warp.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,13 @@ def getConsoleCommands(self, parameters, context, feedback, executing=True):

out = self.parameterAsOutputLayer(parameters, self.OUTPUT, context)
self.setOutputValue(self.OUTPUT, out)

output_format = QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1])
if not output_format:
raise QgsProcessingException(self.tr('Output format is invalid'))

arguments.append('-of')
arguments.append(QgsRasterFileWriter.driverForExtension(os.path.splitext(out)[1]))
arguments.append(output_format)

options = self.parameterAsString(parameters, self.OPTIONS, context)
if options:
Expand Down

0 comments on commit 7bf5cc7

Please sign in to comment.