Skip to content

Commit c9ea2cd

Browse files
authored
Merge pull request #1496 from KodeStar/bugfix/update_proxy_and_items_with_no_password
Update items with no password
2 parents 825f67a + 517f51b commit c9ea2cd

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

app/Http/Controllers/ItemController.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,15 @@ public static function storelogic(Request $request, $id = null): Item
268268
];
269269

270270
// Proxy management
271-
if (isset(getenv('HTTPS_PROXY')) || isset(getenv('https_proxy'))) {
272-
$options['proxy']['http'] = getenv('HTTPS_PROXY') ?: getenv('https_proxy');
271+
$httpsProxy = getenv('HTTPS_PROXY');
272+
$httpsProxyLower = getenv('https_proxy');
273+
if ($httpsProxy !== false || $httpsProxyLower !== false) {
274+
$options['proxy']['http'] = $httpsProxy ?: $httpsProxyLower;
273275
}
274276

275277
$file = $request->input('icon');
276278
$path_parts = pathinfo($file);
277-
if (!isset($path_parts['extension'])) {
279+
if (!array_key_exists('extension', $path_parts)) {
278280
throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']);
279281
}
280282
$extension = $path_parts['extension'];
@@ -317,7 +319,11 @@ public static function storelogic(Request $request, $id = null): Item
317319
$storedConfigObject = json_decode($storedItem->getAttribute('description'));
318320

319321
$configObject = json_decode($config);
320-
$configObject->password = $storedConfigObject->password;
322+
if ($storedConfigObject && property_exists($storedConfigObject, 'password')) {
323+
$configObject->password = $storedConfigObject->password;
324+
} else {
325+
$configObject->password = null;
326+
}
321327

322328
$config = json_encode($configObject);
323329
}

0 commit comments

Comments
 (0)