assistant: Handle http:// links in /fetch (#14243)

Previously http://google.com would get modified to
https://http://google.com which doesn't work. I assume http links should
be supported.

Release Notes:

- N/A
This commit is contained in:
TC 2024-07-11 21:30:45 +02:00 committed by GitHub
parent b0dbc80575
commit d9d8c1f6d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,7 +27,7 @@ pub(crate) struct FetchSlashCommand;
impl FetchSlashCommand {
async fn build_message(http_client: Arc<HttpClientWithUrl>, url: &str) -> Result<String> {
let mut url = url.to_owned();
if !url.starts_with("https://") {
if !url.starts_with("https://") && !url.starts_with("http://") {
url = format!("https://{url}");
}