Merge pull request #1496 from KodeStar/bugfix/update_proxy_and_items_with_no_password
Some checks failed
Mark stale issues and pull requests / stale (push) Has been cancelled

Update items with no password
This commit is contained in:
KodeStar
2025-09-10 16:15:23 +01:00
committed by GitHub

View File

@@ -268,13 +268,15 @@ class ItemController extends Controller
]; ];
// Proxy management // Proxy management
if (isset(getenv('HTTPS_PROXY')) || isset(getenv('https_proxy'))) { $httpsProxy = getenv('HTTPS_PROXY');
$options['proxy']['http'] = getenv('HTTPS_PROXY') ?: getenv('https_proxy'); $httpsProxyLower = getenv('https_proxy');
if ($httpsProxy !== false || $httpsProxyLower !== false) {
$options['proxy']['http'] = $httpsProxy ?: $httpsProxyLower;
} }
$file = $request->input('icon'); $file = $request->input('icon');
$path_parts = pathinfo($file); $path_parts = pathinfo($file);
if (!isset($path_parts['extension'])) { if (!array_key_exists('extension', $path_parts)) {
throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']); throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']);
} }
$extension = $path_parts['extension']; $extension = $path_parts['extension'];
@@ -317,7 +319,11 @@ class ItemController extends Controller
$storedConfigObject = json_decode($storedItem->getAttribute('description')); $storedConfigObject = json_decode($storedItem->getAttribute('description'));
$configObject = json_decode($config); $configObject = json_decode($config);
$configObject->password = $storedConfigObject->password; if ($storedConfigObject && property_exists($storedConfigObject, 'password')) {
$configObject->password = $storedConfigObject->password;
} else {
$configObject->password = null;
}
$config = json_encode($configObject); $config = json_encode($configObject);
} }