github source v1
This commit is contained in:
parent
71f89dde9c
commit
caf870d05e
50 changed files with 4139 additions and 131 deletions
|
|
@ -1,4 +1,5 @@
|
|||
use crate::domain::app::{AppIdentity, IdentityConfidence};
|
||||
use crate::source::input::classify_input;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
pub enum IdentityFallback {
|
||||
|
|
@ -34,6 +35,18 @@ pub fn resolve_identity(
|
|||
});
|
||||
}
|
||||
|
||||
if let Some(source_url) = source_url.filter(|value| !value.trim().is_empty())
|
||||
&& let Ok(classified) = classify_input(source_url)
|
||||
&& let Some(repo) = classified.canonical_locator
|
||||
{
|
||||
let display_name = repo.split('/').next_back().unwrap_or(&repo).to_owned();
|
||||
return Ok(AppIdentity {
|
||||
stable_id: normalize_identifier(&repo),
|
||||
display_name,
|
||||
confidence: IdentityConfidence::Confident,
|
||||
});
|
||||
}
|
||||
|
||||
if let Some(source_url) = source_url.filter(|value| !value.trim().is_empty())
|
||||
&& fallback == IdentityFallback::AllowRawUrl
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue