Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix ssh key migration broken with the new team check

peaklabs-dev2932d9a6e0ed
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php
index fe8a594db7..fab1f1de7a 100644
--- a/app/Models/PrivateKey.php
+++ b/app/Models/PrivateKey.php
@@ -218,9 +218,14 @@ class PrivateKey extends BaseModel
private static function fingerprintExists($fingerprint, $excludeId = null)
{
- return self::query()
- ->where('fingerprint', $fingerprint)
- ->where('team_id', currentTeam()->id)
+ $query = self::query()
+ ->where('fingerprint', $fingerprint);
+
+ if (currentTeam()) {
+ $query->where('team_id', currentTeam()->id);
+ }
+
+ return $query
->when($excludeId, fn ($query) => $query->where('id', '!=', $excludeId))
->exists();
}