apache / cordova-lib

Apache Cordova Tooling Library
https://cordova.apache.org/
Apache License 2.0
221 stars 243 forks source link

restore-util doesn't properly find platform spec info #878

Closed breautek closed 3 years ago

breautek commented 3 years ago

Bug Report

Problem

Code:

https://github.com/apache/cordova-lib/blob/dd872f044211592b11c17d23d56cd17192e4b51f/src/cordova/restore-util.js#L99-L112

What is expected to happen?

This should be able to find the spec version

What does actually happen?

spec will always result in undefined

Information

This is because we are comparing pkgJson.cordova.platforms which is an array of non-prefixed cordova platforms, and then we are comparing those values against dependencies or devDependencies which is always going to be a cordova- prefixed platform. This compatibility will always result in an undefined spec.

This issue is described more in depth in this thread.

Command or Code

Environment, Platform, Device

Version information

Checklist