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: Add newline character to private key before saving

Andras Bacsai311c11883481
diff --git a/app/Models/PrivateKey.php b/app/Models/PrivateKey.php
index 187dfca58d..8804963445 100644
--- a/app/Models/PrivateKey.php
+++ b/app/Models/PrivateKey.php
@@ -14,6 +14,17 @@ class PrivateKey extends BaseModel
'team_id',
];
+ protected static function booted()
+ {
+ static::saving(function ($key) {
+ $privateKey = data_get($key, 'private_key');
+ if (substr($privateKey, -1) !== "\n") {
+ $key->private_key = $privateKey."\n";
+ }
+ });
+
+ }
+
public static function ownedByCurrentTeam(array $select = ['*'])
{
$selectArray = collect($select)->concat(['id']);