mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-13 12:07:41 +00:00
fix: plugin descriptor should not reply on changelog for latest version
This commit is contained in:
@@ -54,7 +54,7 @@ struct PluginDescriptor
|
|||||||
std::string description; // Plugin description
|
std::string description; // Plugin description
|
||||||
std::string author; // Plugin author from manifest, if available
|
std::string author; // Plugin author from manifest, if available
|
||||||
std::string version; // Selected plugin version
|
std::string version; // Selected plugin version
|
||||||
std::string latest_version; // Latest available cloud version fallback when changelog is unavailable.
|
std::string latest_version; // Authoritative latest available cloud version.
|
||||||
std::string installed_version; // Locally installed package version. Preserved across cloud merges, which overwrite `version` with the latest cloud version. Empty when not installed.
|
std::string installed_version; // Locally installed package version. Preserved across cloud merges, which overwrite `version` with the latest cloud version. Empty when not installed.
|
||||||
std::vector<std::string> display_types; // Display-only "compatibility" labels (cloud: raw service labels; local: from real capabilities). Never used for dispatch.
|
std::vector<std::string> display_types; // Display-only "compatibility" labels (cloud: raw service labels; local: from real capabilities). Never used for dispatch.
|
||||||
std::string plugin_root; // Installed plugin directory, even when entry_path is invalid or ambiguous.
|
std::string plugin_root; // Installed plugin directory, even when entry_path is invalid or ambiguous.
|
||||||
@@ -113,10 +113,6 @@ struct PluginDescriptor
|
|||||||
bool is_unauthorized() const { return get_update_status() == PluginUpdateStatus::Unauthorized; }
|
bool is_unauthorized() const { return get_update_status() == PluginUpdateStatus::Unauthorized; }
|
||||||
std::string latest_available_version() const
|
std::string latest_available_version() const
|
||||||
{
|
{
|
||||||
for (const PluginChangelog& entry : changelog) {
|
|
||||||
if (!entry.version.empty())
|
|
||||||
return entry.version;
|
|
||||||
}
|
|
||||||
if (!latest_version.empty())
|
if (!latest_version.empty())
|
||||||
return latest_version;
|
return latest_version;
|
||||||
return version;
|
return version;
|
||||||
|
|||||||
@@ -52,6 +52,29 @@ print('ok')
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
TEST_CASE("plugin latest version uses the authoritative catalog field", "[PluginDescriptor]")
|
||||||
|
{
|
||||||
|
PluginDescriptor descriptor;
|
||||||
|
descriptor.version = "1.3.0";
|
||||||
|
descriptor.latest_version = "1.3.0";
|
||||||
|
PluginChangelog changelog;
|
||||||
|
changelog.version = "1.2.0";
|
||||||
|
descriptor.changelog.push_back(changelog);
|
||||||
|
|
||||||
|
CHECK(descriptor.latest_available_version() == "1.3.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("plugin latest version falls back to the descriptor version", "[PluginDescriptor]")
|
||||||
|
{
|
||||||
|
PluginDescriptor descriptor;
|
||||||
|
descriptor.version = "1.1.0";
|
||||||
|
PluginChangelog changelog;
|
||||||
|
changelog.version = "1.0.0";
|
||||||
|
descriptor.changelog.push_back(changelog);
|
||||||
|
|
||||||
|
CHECK(descriptor.latest_available_version() == "1.1.0");
|
||||||
|
}
|
||||||
|
|
||||||
// Regression: update_cloud_metadata() replaces a matched entry's descriptor wholesale with the
|
// Regression: update_cloud_metadata() replaces a matched entry's descriptor wholesale with the
|
||||||
// cloud catalog record (`entry = cloud_entry`). Configuration used to ride on the descriptor, so
|
// cloud catalog record (`entry = cloud_entry`). Configuration used to ride on the descriptor, so
|
||||||
// that overwrite silently wiped it and plugins fell back to their built-in defaults (found via
|
// that overwrite silently wiped it and plugins fell back to their built-in defaults (found via
|
||||||
|
|||||||
Reference in New Issue
Block a user