浏览代码

Decode raw snippets to avoid > etc

master
Dylan Baker 5 年前
父节点
当前提交
698c97bcc1
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1
    1
      src/routes.rs

+ 1
- 1
src/routes.rs 查看文件

@@ -50,7 +50,7 @@ pub fn show_snippet(uuid: String, connection: DbConn) -> Template {
50 50
 #[get("/snippets/<uuid>/raw")]
51 51
 pub fn show_raw_snippet(uuid: String, connection: DbConn) -> String {
52 52
     match snippet::get(&connection, &uuid) {
53
-        Ok(snippet) => snippet.body,
53
+        Ok(snippet) => htmlescape::decode_html(&snippet.body).expect("Invalid HTML"),
54 54
         Err(_) => String::from("Snippet not found"),
55 55
     }
56 56
 }

正在加载...
取消
保存