fix: Allow special characters for export script (#128)
This commit is contained in:
parent
338b9c699e
commit
aa1de26ad9
3 changed files with 34 additions and 30 deletions
|
|
@ -22,35 +22,10 @@ pub struct ContainerFileTemplate<'a> {
|
|||
#[builder(setter(into))]
|
||||
build_id: Uuid,
|
||||
|
||||
#[builder(default)]
|
||||
export_script: ExportsTemplate,
|
||||
|
||||
#[builder(setter(into))]
|
||||
os_version: Cow<'a, str>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Default, Template)]
|
||||
#[template(path = "export.sh", escape = "none")]
|
||||
pub struct ExportsTemplate;
|
||||
|
||||
impl ExportsTemplate {
|
||||
fn print_script(&self) -> String {
|
||||
trace!("print_script({self})");
|
||||
|
||||
format!(
|
||||
"\"{}\"",
|
||||
self.render()
|
||||
.unwrap_or_else(|e| {
|
||||
error!("Failed to render export.sh script: {e}");
|
||||
process::exit(1);
|
||||
})
|
||||
.replace('\n', "\\n")
|
||||
.replace('\"', "\\\"")
|
||||
.replace('$', "\\$")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, Template, TypedBuilder)]
|
||||
#[template(path = "github_issue.j2", escape = "md")]
|
||||
pub struct GithubIssueTemplate<'a> {
|
||||
|
|
@ -97,6 +72,12 @@ pub struct GithubIssueTemplate<'a> {
|
|||
terminal_version: Cow<'a, str>,
|
||||
}
|
||||
|
||||
fn print_export_script() -> String {
|
||||
trace!("print_export_script()");
|
||||
|
||||
include_str!("../templates/export.sh").replace('$', r"\$")
|
||||
}
|
||||
|
||||
fn has_cosign_file() -> bool {
|
||||
trace!("has_cosign_file()");
|
||||
std::env::current_dir()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue