Merge #924f78e1: fix: report an installed app's declared author
nostr:nevent1qqsfynmcuy5fruzzxmvz7jdw47hf07nr8kjmuh2s0f8v8e9etr00n2qpz3mhxue69uhhyetvv9ujumn8d96zuer9wczsgytw PR-Author: TheCryptoDonkey nostr:npub1mgvlrnf5hm9yf0n5mf9nqmvarhvxkc6remu5ec3vf8r0txqkuk7su0e7q2 PR description: The scanner credits every installed app to Archipelago, whatever metadata.author its manifest declares. apply_manifest_value already reads icon, tier and licence from metadata; this reads author too, keeping the scanner's default when none is declared. One test added; docker_packages tests pass (27/27).
This commit is contained in:
@@ -553,6 +553,24 @@ mod lifecycle_regression_tests {
|
||||
assert_eq!(entry.static_files.license, "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn manifest_presentation_reports_the_declared_author() {
|
||||
let mut entry = installing_fixture();
|
||||
entry.manifest.author = Some("Archipelago".to_owned());
|
||||
for (metadata, expected) in [
|
||||
(serde_json::json!({}), "Archipelago"),
|
||||
(serde_json::json!({"author":" "}), "Archipelago"),
|
||||
(serde_json::json!({"author":3}), "Archipelago"),
|
||||
(serde_json::json!({"author":" ForgeSworn "}), "ForgeSworn"),
|
||||
] {
|
||||
apply_manifest_value(
|
||||
&serde_json::json!({"app":{"metadata":metadata}}),
|
||||
&mut entry,
|
||||
);
|
||||
assert_eq!(entry.manifest.author.as_deref(), Some(expected));
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn installed_manifest_entry_path_survives_scans_without_changing_runtime_origin() {
|
||||
let mut entry = installing_fixture();
|
||||
@@ -882,6 +900,10 @@ fn apply_manifest_value(value: &serde_json::Value, entry: &mut PackageDataEntry)
|
||||
if let Some(icon) = text(metadata.get("icon")) {
|
||||
entry.static_files.icon = icon;
|
||||
}
|
||||
// The scanner's default author is the node OS; a declared author wins.
|
||||
if let Some(author) = text(metadata.get("author")) {
|
||||
entry.manifest.author = Some(author);
|
||||
}
|
||||
if let Some(tier) = text(metadata.get("tier")) {
|
||||
entry.manifest.tier = Some(tier);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user