You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/12/16 15:12:46 UTC
[GitHub] [nifi-minifi-cpp] martinzink commented on a diff in pull request #1479: MINIFICPP-1697 Give a better error message on unsupported algorithms …
martinzink commented on code in PR #1479:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1479#discussion_r1050861416
##########
extensions/standard-processors/processors/HashContent.cpp:
##########
@@ -50,18 +52,24 @@ void HashContent::onSchedule(core::ProcessContext *context, core::ProcessSession
std::string value;
attrKey_ = (context->getProperty(HashAttribute.getName(), value)) ? value : "Checksum";
- algoName_ = (context->getProperty(HashAlgorithm.getName(), value)) ? value : "SHA256";
if (context->getProperty(FailOnEmpty.getName(), value)) {
failOnEmpty_ = utils::StringUtils::toBool(value).value_or(false);
} else {
failOnEmpty_ = false;
}
- std::transform(algoName_.begin(), algoName_.end(), algoName_.begin(), ::toupper);
-
- // Erase '-' to make sha-256 and sha-1 work, too
- algoName_.erase(std::remove(algoName_.begin(), algoName_.end(), '-'), algoName_.end());
+ {
+ auto algo_name = (context->getProperty(HashAlgorithm.getName(), value)) ? value : "SHA256";
+ std::transform(algo_name.begin(), algo_name.end(), algo_name.begin(), ::toupper);
Review Comment:
good idea, I've simplified the onSchedule in https://github.com/apache/nifi-minifi-cpp/pull/1479/commits/f0f4718ed3d49092e2326df5e41b499af560c582
--
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-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org