A free open source IT asset/license management system
Sync Adapters: trim() asset name so “ “ gets counted as blank
snipe8bdeeed7e743
diff --git a/app/SyncAdapters/SyncsHostFromRecord.php b/app/SyncAdapters/SyncsHostFromRecord.phpindex 0af71a8d0d..f170af2f7d 100644--- a/app/SyncAdapters/SyncsHostFromRecord.php+++ b/app/SyncAdapters/SyncsHostFromRecord.php@@ -790,16 +790,17 @@ trait SyncsHostFromRecord// Only overwrite when the vendor sent a non-empty tag,// so a sync run that happens to omit the tag doesn't// blank whatever the admin already curated.- if ($value !== null && $value !== '') {- $asset->asset_tag = $value;+ $tag = is_string($value) ? trim($value) : $value;+ if ($tag !== null && $tag !== '') {+ $asset->asset_tag = $tag;}break;case 'notes':- // Same non-empty guard as asset_tag. Reachable when- // an admin routes a text-like extra (fleet_labels,- // kandji_blueprint_id, etc.) to native:notes.- if ($value !== null && $value !== '') {- $asset->notes = $value;+ // Same non-empty guard as asset_tag, with the same+ // whitespace-only coercion.+ $notes = is_string($value) ? trim($value) : $value;+ if ($notes !== null && $notes !== '') {+ $asset->notes = $notes;}break;case 'model':