Skip to content

Conversation

capossele
Copy link
Contributor

Overrides the IPFS gateway in a given URL. The new gateway URL is taken from the IPFS_GATEWAY_URL environment variable, or defaults to BOUNDLESS_IPFS_GATEWAY_URL if the variable is not set

Copy link

linear bot commented Oct 15, 2025

@github-actions github-actions bot changed the title add override IPFS gateway BM-1714: add override IPFS gateway Oct 15, 2025
Comment on lines 616 to 626
self.fetch_and_upload_image(
"assessor",
prover,
image_id,
override_gateway(&image_url_str),
path,
default_url,
)
.await
.context("uploading assessor image")?;
Ok(image_id)
Copy link
Contributor

@willpote willpote Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we try URL, if fail try custom gateway, if fail try contract specified gateway. Since our custom gateway that we pay for is now a point of failure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, addressed with d95ad89

Comment on lines +68 to +75
let parts: Vec<&str> = url.splitn(2, "/ipfs/").collect();
if parts.len() != 2 {
return url.to_string();
}

let gateway_url =
std::env::var("IPFS_GATEWAY_URL").unwrap_or(BOUNDLESS_IPFS_GATEWAY_URL.to_string());
let new_url = format!("{gateway_url}/ipfs/{}", parts[1]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let parts: Vec<&str> = url.splitn(2, "/ipfs/").collect();
if parts.len() != 2 {
return url.to_string();
}
let gateway_url =
std::env::var("IPFS_GATEWAY_URL").unwrap_or(BOUNDLESS_IPFS_GATEWAY_URL.to_string());
let new_url = format!("{gateway_url}/ipfs/{}", parts[1]);
let Some((_, cid)) = url.split_once("/ipfs/") else {
return url.to_string();
};
let gateway_url =
std::env::var("IPFS_GATEWAY_URL").unwrap_or(BOUNDLESS_IPFS_GATEWAY_URL.to_string());
let new_url = format!("{gateway_url}/ipfs/{cid}");

Completely optional pass-by suggestion to make this a bit cleaner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants