diff --git a/CHANGELOG.md b/CHANGELOG.md index 640bddb..29369d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 7.0.2 + +* Fix issue where declared extensions dependencies with no min/max version always overwrite previously installed versions (even if a lower version) + ## 7.0.1 * Fix issue where dependencies installed in ways other then box.json would be overwritten when marked as a dependency of another extension. Causing issues with the wrong versions of software being installed. diff --git a/interceptors/PresideCommandsPostInstallInterceptor.cfc b/interceptors/PresideCommandsPostInstallInterceptor.cfc index d6d8e5e..98306c6 100644 --- a/interceptors/PresideCommandsPostInstallInterceptor.cfc +++ b/interceptors/PresideCommandsPostInstallInterceptor.cfc @@ -116,26 +116,29 @@ component { try { var depboxjson = DeserializeJson( FileRead( depBoxJsonLocation ) ); } catch( any e ) { + return false; } versionInstalled = depboxjson.version ?: ""; } - if ( Len( Trim( versionInstalled ) ) && ( hasMinVer || hasMaxVer ) ) { - if ( ListLen( versionInstalled, "##@" ) == 2 ) { - versionInstalled = ListRest( versionInstalled, "##@" ); - } - if ( ListLen( versionInstalled, "-" ) > 1 ) { - versionInstalled = ListFirst( versionInstalled, "-" ); - } + if ( Len( Trim( versionInstalled ) ) ) { + if ( hasMinVer || hasMaxVer ) { + if ( ListLen( versionInstalled, "##@" ) == 2 ) { + versionInstalled = ListRest( versionInstalled, "##@" ); + } + if ( ListLen( versionInstalled, "-" ) > 1 ) { + versionInstalled = ListFirst( versionInstalled, "-" ); + } - if ( hasMinVer && semanticVersion.compare( dependencyInfo.minVersion, versionInstalled ) == 1 ) { - throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] does not meet the minimum version requirement of [#dependencyInfo.minVersion#]. Please upgrade your [#dependencySlug#] extension to continue." ); - } + if ( hasMinVer && semanticVersion.compare( dependencyInfo.minVersion, versionInstalled ) == 1 ) { + throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] does not meet the minimum version requirement of [#dependencyInfo.minVersion#]. Please upgrade your [#dependencySlug#] extension to continue." ); + } - if ( hasMaxVer && semanticVersion.compare( versionInstalled, dependencyInfo.maxVersion ) == 1 ) { - throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] exceeds the maximum version requirement of [#dependencyInfo.maxVersion#]. You will need to manually resolve this situation by either downgrading [#dependencySlug#], installing a later version of [#packageSlug#], or getting the package maintainers of [#packageSlug#] to update the package to be compatible with later versions of [#dependencySlug#]." ); + if ( hasMaxVer && semanticVersion.compare( versionInstalled, dependencyInfo.maxVersion ) == 1 ) { + throw( type="preside.extension.dependency.version.mismatch", message="The already installed dependency [#dependencySlug#] of package [#packageSlug#] exceeds the maximum version requirement of [#dependencyInfo.maxVersion#]. You will need to manually resolve this situation by either downgrading [#dependencySlug#], installing a later version of [#packageSlug#], or getting the package maintainers of [#packageSlug#] to update the package to be compatible with later versions of [#dependencySlug#]." ); + } } return true;