cli: Prevent weird `rad issue open` behavior
Verify special YAML strings '~' and 'null' are filtered out when processing the input from the editor. Serde replaces empty strings with their values causing an empty title to become '~'. Best to avoid them entirely and be transparent about it. The solution is not meant to be long term. This editor format for getting issue data will be replaced in the near term.
This commit is contained in:
parent
5d20316c57
commit
16822ff84e
|
|
@ -507,10 +507,12 @@ fn prompt_issue(
|
|||
serde_yaml::from_str(&meta).context("failed to parse yaml front-matter")?;
|
||||
|
||||
meta.title = meta.title.trim().to_string();
|
||||
if meta.title.is_empty() {
|
||||
if meta.title.is_empty() || meta.title == "~" || meta.title == "null" {
|
||||
// '~' and 'null' are YAML's string values for null and unexpectedly replace empty fields
|
||||
// for String.
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::InvalidInput,
|
||||
"an issue title must be provided",
|
||||
"an issue title must be provided and may not be '~' or 'null'",
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue