File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 27
27
#include " qgsprocessingalgorithm.h"
28
28
#include " qgsvectorlayerfeatureiterator.h"
29
29
#include " qgsexpressioncontextscopegenerator.h"
30
+ #include " qgsfileutils.h"
30
31
31
32
QList<QgsRasterLayer *> QgsProcessingUtils::compatibleRasterLayers ( QgsProject *project, bool sort )
32
33
{
@@ -539,7 +540,7 @@ QString QgsProcessingUtils::generateTempFilename( const QString &basename )
539
540
QDir tmpDir;
540
541
tmpDir.mkdir ( path );
541
542
}
542
- return path + ' /' + basename;
543
+ return path + ' /' + QgsFileUtils::stringToSafeFilename ( basename ) ;
543
544
}
544
545
545
546
QString QgsProcessingUtils::formatHelpMapAsHtml ( const QVariantMap &map, const QgsProcessingAlgorithm *algorithm )
Original file line number Diff line number Diff line change @@ -5797,6 +5797,11 @@ void TestQgsProcessing::tempUtils()
5797
5797
QVERIFY ( tempFile1 != tempFile2 );
5798
5798
QVERIFY ( tempFile2.endsWith ( " test.txt" ) );
5799
5799
QVERIFY ( tempFile2.startsWith ( tempFolder ) );
5800
+
5801
+ // invalid characters
5802
+ QString tempFile3 = QgsProcessingUtils::generateTempFilename ( " mybad:file.txt" );
5803
+ QVERIFY ( tempFile3.endsWith ( " mybad_file.txt" ) );
5804
+ QVERIFY ( tempFile3.startsWith ( tempFolder ) );
5800
5805
}
5801
5806
5802
5807
void TestQgsProcessing::convertCompatible ()
You can’t perform that action at this time.
0 commit comments