Skip to content

Commit 5e5296e

Browse files
clemenssschuberth
authored andcommitted
fix(Bundler): Enforce Ruby platform when fetching version data
Fetching version data for individual Ruby gems shouldn't rely on creation order of the gems on RubyGems.org. Instead, use the standard `ruby` platform as a sensible default (as it already happens in Bundler's resolving logic elsewhere in the code). Partially addresses #8695. Signed-off-by: Clemens Kofler <[email protected]>
1 parent 9e6bf29 commit 5e5296e

File tree

1 file changed

+5
-2
lines changed
  • plugins/package-managers/bundler/src/main/kotlin

1 file changed

+5
-2
lines changed

plugins/package-managers/bundler/src/main/kotlin/Bundler.kt

+5-2
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ class Bundler(
358358
workingDir.walk().maxDepth(1).filter { it.isFile && it.extension == "gemspec" }.firstOrNull()
359359

360360
private fun queryRubygems(name: String, version: String, retryCount: Int = 3): GemSpec? {
361-
// See http://guides.rubygems.org/rubygems-org-api-v2/.
362-
val url = "https://rubygems.org/api/v2/rubygems/$name/versions/$version.yaml"
361+
// NOTE: Explicitly use platform=ruby here to enforce the same behavior here that is also used in the Bundler
362+
// resolving logic.
363+
// See plugins/package-managers/bundler/src/main/resources/resolve_dependencies.rb
364+
// See <http://guides.rubygems.org/rubygems-org-api-v2/>.
365+
val url = "https://rubygems.org/api/v2/rubygems/$name/versions/$version.yaml?platform=ruby"
363366

364367
return okHttpClient.downloadText(url).mapCatching {
365368
GemSpec.createFromGem(yamlMapper.readTree(it))

0 commit comments

Comments
 (0)