index : gitrs
A lightweight web interface for browsing Git repositories, implemented in Rust
about summary refs log tree commit diff

Diffstat (limited to 'src/git/diff.rs')

-rw-r--r-- src/git/diff.rs 9
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/git/diff.rs b/src/git/diff.rs
index d246b42..c25c551 100644
--- a/src/git/diff.rs
+++ b/src/git/diff.rs
@@ -440,8 +440,9 @@

impl DiffFormatter for PlainDiffFormatter {
    fn file_header(&self, output: &mut String, data: fmt::Arguments<'_>) {
        write!(output, r#"<span class="diff-file-header">{data}</span>"#).unwrap();
        output.push('\n');
        output.push_str(r#"<span class="diff-file-header">"#);
        write!(output, "{data}").unwrap();
        output.push_str("</span>\n");
    }

    fn write(&self, output: &mut String, class: &str, data: &str) {
@@ -466,8 +467,10 @@
        if is_null {
            "/dev/null".to_string()
        } else {
            let escaped_path = v_htmlescape::escape(&rela_path.to_string()).to_string();
            let escaped_rev = v_htmlescape::escape(rev_id).to_string();
            format!(
                "{prefix}/<a class='{state}' href='/{repo_name}/diff/{rela_path}?id={rev_id}'>{rela_path}</a>"
                "{prefix}/<a class='{state}' href='/{repo_name}/diff/{escaped_path}?id={escaped_rev}'>{escaped_path}</a>"
            )
        }
    }