--- parser3/src/classes/file.C 2024/10/22 02:44:40 1.283 +++ parser3/src/classes/file.C 2024/11/06 21:56:23 1.286 @@ -1,7 +1,7 @@ /** @file Parser: @b file parser class. - Copyright (c) 2001-2023 Art. Lebedev Studio (http://www.artlebedev.com) + Copyright (c) 2001-2024 Art. Lebedev Studio (http://www.artlebedev.com) Authors: Konstantin Morshnev , Alexandr Petrosian */ @@ -27,7 +27,7 @@ #include "pa_vregex.h" #include "pa_version.h" -volatile const char * IDENT_FILE_C="$Id: file.C,v 1.283 2024/10/22 02:44:40 moko Exp $"; +volatile const char * IDENT_FILE_C="$Id: file.C,v 1.286 2024/11/06 21:56:23 moko Exp $"; // defines @@ -555,7 +555,7 @@ static void _exec_cgi(Request& r, Method if(i.value()){ const String *string=i.value()->get_string(); if(!string) - i.value()->bark("array element is '%s', it does not string value"); + i.value()->bark("array element is '%s', it does not have string value"); append_to_argv(r, argv, string); } } @@ -563,6 +563,15 @@ static void _exec_cgi(Request& r, Method throw Exception(PARSER_RUNTIME, 0, "param must be string or table or array of strings"); } } + + // remove trailing empty arguments for backward compatibility + for(ArrayString::ReverseIterator i(argv); i;){ + if(i.prev()->is_empty()){ // here for correct i.index() + argv.remove(i.index()); + } else { + break; + } + } } // transcode if necessary