talk-llama : improve quote and backtick handling (#1364)

* ISSUE-1329: replace " with ' so it doesn't try to execute code in backticks.

* Typo

* Update to keep possessives in the output

Closes the ' then puts a ' in quotes then reopens the ' to escape the ' characters.
This commit is contained in:
Sam Pullara 2023-11-16 00:34:05 -08:00 committed by GitHub
parent ccc85b4ff8
commit 7883d1cae4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -686,8 +686,8 @@ int main(int argc, char ** argv) {
}
}
text_to_speak = ::replace(text_to_speak, "\"", "");
int ret = system((params.speak + " " + std::to_string(voice_id) + " \"" + text_to_speak + "\"").c_str());
text_to_speak = ::replace(text_to_speak, "'", "'\"'\"'");
int ret = system((params.speak + " " + std::to_string(voice_id) + " '" + text_to_speak + "'").c_str());
if (ret != 0) {
fprintf(stderr, "%s: failed to speak\n", __func__);
}