Skip to content

Commit

Permalink
docs(npm): explain situations where parsing resolved can fail
Browse files Browse the repository at this point in the history
Follow up for the following discussion dependabot#7030 (comment)
  • Loading branch information
yeikel committed Apr 18, 2023
1 parent 5ff6316 commit 0da4006
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion npm_and_yarn/lib/dependabot/npm_and_yarn/file_fetcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ def inferred_npmrc # rubocop:disable Metrics/PerceivedComplexity
known_registries = []
JSON.parse(package_lock.content).fetch("dependencies", {}).each do |dependency_name, details|
resolved = details.fetch("resolved", DEFAULT_NPM_REGISTRY)

begin
uri = URI.parse(resolved)
rescue URI::InvalidURIError
# Ignoring non-URIs since they're not registries.
# This can happen if resolved is `false`, for instance. This can happen due to the following npm6 bug https://github.com/npm/cli/issues/1138
next
end

Expand Down

0 comments on commit 0da4006

Please sign in to comment.