Add more robust version of is_external_link_storeid() helper function

This commit is contained in:
Matthias Beyer 2016-07-14 21:27:36 +02:00
parent 1dd40ca8b9
commit 3f2ababdb0

View file

@ -97,7 +97,7 @@ pub trait ExternalLinker : InternalLinker {
/// Check whether the StoreId starts with `/link/external/` /// Check whether the StoreId starts with `/link/external/`
pub fn is_external_link_storeid(id: &StoreId) -> bool { pub fn is_external_link_storeid(id: &StoreId) -> bool {
debug!("Checking whether this is a /link/external/*: '{:?}'", id); debug!("Checking whether this is a /link/external/*: '{:?}'", id);
id.to_str().map(|s| s.contains("/link/external/")).unwrap_or(false) id.parent().map(|par| par.ends_with("/link/external")).unwrap_or(false)
} }
fn get_external_link_from_file(entry: &FileLockEntry) -> Result<Url> { fn get_external_link_from_file(entry: &FileLockEntry) -> Result<Url> {