Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make extracting a the download_id more robust #1260

Merged
merged 1 commit into from
Jul 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions crates/symbolicator-service/src/services/sourcemap_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
//! single [`ArtifactBundle`], using [`DebugId`]s. Legacy usage of individual artifact files
//! and web scraping should trend to `0` with time.

use std::borrow::Cow;
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::fmt::{self, Write};
use std::fs::File;
Expand Down Expand Up @@ -118,12 +119,11 @@ async fn maybe_fetch_bundle_index(
url: Option<Url>,
) -> Option<Arc<BundleIndex>> {
let url = url?;
// We expect the url to look like `?download=foo-bar`, so split by the `=`.
// We expect the url to have a parameter like `?download=foo-bar`.
let file_id = url
.as_str()
.rsplit_once('=')
.map(|(_, id)| id)
.unwrap_or(url.as_str());
.query_pairs()
.find_map(|(k, v)| (k == "download").then_some(v))
.unwrap_or(Cow::Borrowed(url.as_str()));

let file = SentryRemoteFile::new(
Arc::clone(source),
Expand Down Expand Up @@ -748,10 +748,10 @@ impl ArtifactFetcher {
// NOTE: we ideally wanted to move away from hardcoded URLs,
// but now we are back to square one -_-
let mut download_url = self.source.url.clone();
{
let mut query = download_url.query_pairs_mut();
query.append_pair("download", &bundle_id);
}
download_url
.query_pairs_mut()
.append_pair("download", &bundle_id);

let sentry_file = SentryRemoteFile::new(
Arc::clone(&self.source),
true,
Expand Down
Loading