mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fix .env quoting issue (#15298)
Triggered when password contains # and .env file uses windows line returns. Friends don't let friends use windows line returns
This commit is contained in:
@@ -163,7 +163,7 @@ class EnvHelper
|
||||
$parts = explode('=', $line, 2);
|
||||
if (isset($parts[1])
|
||||
&& preg_match('/(?<!\s)#/', $parts[1]) // number symbol without a space before it
|
||||
&& ! preg_match('/^(".*"|\'.*\')$/', $parts[1]) // not already quoted
|
||||
&& ! preg_match('/^(".*"|\'.*\')$/', trim($parts[1])) // not already quoted
|
||||
) {
|
||||
return trim($parts[0]) . '="' . trim($parts[1]) . '"';
|
||||
}
|
||||
|
Reference in New Issue
Block a user