Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Normalize json-schema.org to https over http (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe authored Aug 1, 2024
1 parent be92c44 commit 074cf3a
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/tbdex/src/json_schemas/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl LocalSchemaResolver {
serde_json::from_str(&DEFINITIONS_JSON_SCHEMA.replace("\\#", "#")).unwrap(),
);
schemas.insert(
"http://json-schema.org/draft-07/schema".to_string(),
"https://json-schema.org/draft-07/schema".to_string(),
serde_json::from_str(&DRAFT_07_JSON_SCHEMA.replace("\\#", "#")).unwrap(),
);
LocalSchemaResolver { schemas }
Expand All @@ -47,7 +47,11 @@ impl LocalSchemaResolver {
fn normalize_url(url: &reqwest::Url) -> String {
let mut normalized_url = url.clone();
normalized_url.set_fragment(None);
normalized_url.to_string()
let mut url_str = normalized_url.to_string();
if url_str.starts_with("http://") {
url_str = url_str.replacen("http://", "https://", 1);
}
url_str
}
}

Expand Down

0 comments on commit 074cf3a

Please sign in to comment.