Skip to content

Commit

Permalink
fix: Make sure release exists before querying for artifacts (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilogorek committed Jul 14, 2022
1 parent eeb0d67 commit a2b18b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/commands/sourcemaps/upload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,13 +311,6 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
let api = Api::current();
let mut processor = SourceMapProcessor::new();

for artifact in api.list_release_files(&org, Some(&project), &version)? {
let checksum = Digest::from_str(&artifact.sha1)
.map_err(|_| format_err!("Invalid artifact checksum"))?;

processor.add_already_uploaded_source(checksum);
}

if matches.is_present("bundle") && matches.is_present("bundle_sourcemap") {
process_sources_from_bundle(matches, &mut processor)?;
} else {
Expand All @@ -334,6 +327,13 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
},
)?;

for artifact in api.list_release_files(&org, Some(&project), &release.version)? {
let checksum = Digest::from_str(&artifact.sha1)
.map_err(|_| format_err!("Invalid artifact checksum"))?;

processor.add_already_uploaded_source(checksum);
}

processor.upload(&UploadContext {
org: &org,
project: Some(&project),
Expand Down

0 comments on commit a2b18b3

Please sign in to comment.