Skip to content

Commit

Permalink
fix loading multi-dot extensions
Browse files Browse the repository at this point in the history
Old slug rules for syntax highlighted pastes did not allow for a
multi-dot paste. This fixes it

Signed-off-by: Gunwant Jain <[email protected]>
  • Loading branch information
wantguns committed Jan 25, 2022
1 parent eff3f0d commit ea144a1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/models/pretty_syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub struct PasteIdSyntax<'a> {
fn valid_syn(syn: &str) -> bool {
let mut flag = false;
let split: Vec<&str> = syn.split('.').collect();
if split.len() == 2 {
if split.len() >= 2 {
for s in split {
if s.chars().all(char::is_alphanumeric) {
flag = true;
Expand All @@ -25,7 +25,7 @@ impl<'a> PasteIdSyntax<'a> {
self.syn_id.split('.').collect::<Vec<&str>>()[0]
}
pub fn get_ext(&self) -> &str {
self.syn_id.split('.').collect::<Vec<&str>>()[1]
self.syn_id.split_once('.').unwrap().1
}
}

Expand Down

0 comments on commit ea144a1

Please sign in to comment.