pub fn classify_entry_path(raw: &Path) -> Option<Utf8PathBuf>Expand description
Returns the canonical relative path when raw is a regular file path the
hook accepts, or None otherwise.
Accepted paths are relative, contain only normal components (a leading
./ is tolerated), and lie directly under lib/ or anywhere under
share/extension/.
ยงExamples
use std::path::Path;
use pg_embedded_setup_unpriv::extensions::classify_entry_path;
assert_eq!(
classify_entry_path(Path::new("./lib/vector.so"))
.as_deref()
.map(|p| p.as_str()),
Some("lib/vector.so")
);
assert!(classify_entry_path(Path::new("lib/../bin/psql")).is_none());
assert!(classify_entry_path(Path::new("lib/bitcode/vector.bc")).is_none());