Skip to content

Commit

Permalink
fix: don't show rendered view for non-Markdown files
Browse files Browse the repository at this point in the history
Close #62.
  • Loading branch information
Kyle Clemens committed Jul 15, 2018
1 parent 060ea58 commit 9789637
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion webserver/src/routes/web/pastes/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,9 @@ fn users_username_id(username: String, id: PasteId, config: State<Config>, user:
for file in &files {
if let Some(ref name) = file.name {
let lower = name.to_lowercase();
if !lower.ends_with(".md") && !lower.ends_with(".mdown") && !lower.ends_with(".markdown") {
let md_ext = file.highlight_language.is_none() && lower.ends_with(".md") || lower.ends_with(".mdown") || lower.ends_with(".markdown");
let lang = file.highlight_language == Some(Language::Markdown.hljs());
if !lang && !md_ext {
rendered.insert(file.id, None);
continue;
}
Expand Down

0 comments on commit 9789637

Please sign in to comment.