From 2ec4eebaad1acc5d1b31280c913bf4a9482f066e Mon Sep 17 00:00:00 2001 From: Tarek Date: Sat, 15 Jun 2024 04:29:32 +0300 Subject: [PATCH] fix(ark-cli): only list valid links Signed-off-by: Tarek --- ark-cli/src/commands/list.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ark-cli/src/commands/list.rs b/ark-cli/src/commands/list.rs index acafc92c..bc557b42 100644 --- a/ark-cli/src/commands/list.rs +++ b/ark-cli/src/commands/list.rs @@ -136,7 +136,17 @@ impl List { Ok(mut file) => { let mut contents = String::new(); match file.read_to_string(&mut contents) { - Ok(_) => (None, None, Some(contents)), + Ok(_) => { + // Check if the content of the file is a valid url + let url = contents.trim(); + let url = url::Url::parse(url); + match url { + Ok(url) => { + (None, None, Some(url.to_string())) + } + Err(_) => return None, + } + } Err(_) => return None, } }