From a4bae2568967d93d8bd716807d5a977c1ca42f71 Mon Sep 17 00:00:00 2001 From: Andrea Giudiceandrea Date: Sun, 12 Jan 2025 17:33:32 +0100 Subject: [PATCH] [app] allow to use single quote in file name passed to --code --- src/app/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/main.cpp b/src/app/main.cpp index d64a6aeef29b..6add45cbe21e 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1650,7 +1650,7 @@ int main( int argc, char *argv[] ) //replace backslashes with forward slashes pythonfile.replace( '\\', '/' ); #endif - QgsPythonRunner::run( QStringLiteral( "with open('%1','r') as f: exec(f.read())" ).arg( pythonfile ) ); + QgsPythonRunner::run( QStringLiteral( "with open('%1','r') as f: exec(f.read())" ).arg( pythonfile.replace( QChar( '\'' ), QStringLiteral( "\\'" ) ) ) ); } /////////////////////////////////`////////////////////////////////////