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 1e89513 commit 2d0c25cCopy full SHA for 2d0c25c
lib/src/plugins/reset_pubkey.rs
server/src/helpers.rs
@@ -271,3 +271,21 @@ pub fn get_subject(
271
let subject = format!("{}{}", server_without_last_slash, &req.uri().to_string());
272
Ok(subject)
273
}
274
+
275
+/// Finds the extension
276
+pub fn try_extension(path: &str) -> Option<(ContentType, &str)> {
277
+ let items: Vec<&str> = path.split('.').collect();
278
+ if items.len() == 2 {
279
+ let path = items[0];
280
+ let content_type = match items[1] {
281
+ "json" => ContentType::Json,
282
+ "jsonld" => ContentType::JsonLd,
283
+ "jsonad" => ContentType::JsonAd,
284
+ "html" => ContentType::Html,
285
+ "ttl" => ContentType::Turtle,
286
+ _ => return None,
287
+ };
288
+ return Some((content_type, path));
289
+ }
290
+ None
291
+}
0 commit comments