[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1362: MINIFICPP-1830 Verify regex properties in processors in case it is set to empty
szaszm commented on code in PR #1362: URL: https://github.com/apache/nifi-minifi-cpp/pull/1362#discussion_r924453372 ## extensions/standard-processors/processors/GetFile.cpp: ## @@ -244,7 +244,7 @@ bool GetFile::fileMatchesRequestCriteria(std::string fullName, std::string name, return false; utils::Regex rgx(request.fileFilter); - if (!utils::regexSearch(name, rgx)) { Review Comment: I'm fine any of these: `.*`, `[^\\.].*`, `[^.].*` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1362: MINIFICPP-1830 Verify regex properties in processors in case it is set to empty
szaszm commented on code in PR #1362: URL: https://github.com/apache/nifi-minifi-cpp/pull/1362#discussion_r911902756 ## libminifi/include/utils/HTTPUtils.h: ## @@ -31,14 +31,14 @@ so we convert localhost to our local hostname. inline bool parse_http_components(const std::string , std::string , std::string , std::string ) { #ifdef WIN32 auto hostname = (url.find(org::apache::nifi::minifi::io::Socket::getMyHostName()) != std::string::npos ? org::apache::nifi::minifi::io::Socket::getMyHostName() : "localhost"); - std::string regex_str = "^(http|https)://(" + hostname + ":)([0-9]+)?(/.*)$"; + std::string regex_str = "(http|https)://(" + hostname + ":)([0-9]+)?(/.*)$"; #else - std::string regex_str = "^(http|https)://(localhost:)([0-9]+)?(/.*)$"; + std::string regex_str = "(http|https)://(localhost:)([0-9]+)?(/.*)$"; Review Comment: Please remove the trailing `$` sign / end of line match as well. It should no longer be necessary, just like `^`. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [nifi-minifi-cpp] szaszm commented on a diff in pull request #1362: MINIFICPP-1830 Verify regex properties in processors in case it is set to empty
szaszm commented on code in PR #1362: URL: https://github.com/apache/nifi-minifi-cpp/pull/1362#discussion_r911156740 ## extensions/librdkafka/PublishKafka.cpp: ## @@ -184,12 +184,12 @@ class ReadCallback { }); } - static rd_kafka_headers_unique_ptr make_headers(const core::FlowFile& flow_file, utils::Regex& attribute_name_regex) { + static rd_kafka_headers_unique_ptr make_headers(const core::FlowFile& flow_file, std::optional& attribute_name_regex) { const gsl::owner result{ rd_kafka_headers_new(8) }; if (!result) { throw std::bad_alloc{}; } for (const auto& kv : flow_file.getAttributes()) { - if (utils::regexSearch(kv.first, attribute_name_regex)) { + if (attribute_name_regex && utils::regexSearch(kv.first, *attribute_name_regex)) { Review Comment: Wherever regexSearch is used over regexMatch, we should check if it really makes sense to use subsequence matching. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org