We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 09a58e7 commit 50aba70Copy full SHA for 50aba70
lib/src/plugins/reset_pubkey.rs
server/src/helpers.rs
@@ -307,3 +307,21 @@ pub fn get_subject(
307
let subject = format!("{}{}", server_without_last_slash, &req.uri().to_string());
308
Ok(subject)
309
}
310
+
311
+/// Finds the extension
312
+pub fn try_extension(path: &str) -> Option<(ContentType, &str)> {
313
+ let items: Vec<&str> = path.split('.').collect();
314
+ if items.len() == 2 {
315
+ let path = items[0];
316
+ let content_type = match items[1] {
317
+ "json" => ContentType::Json,
318
+ "jsonld" => ContentType::JsonLd,
319
+ "jsonad" => ContentType::JsonAd,
320
+ "html" => ContentType::Html,
321
+ "ttl" => ContentType::Turtle,
322
+ _ => return None,
323
+ };
324
+ return Some((content_type, path));
325
+ }
326
+ None
327
+}
0 commit comments