Skip to content

Commit 73996d3

Browse files
committed
Fix bug in node update
1 parent 59f9ab6 commit 73996d3

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

app/Http/Controllers/Admin/NodesController.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ public function postView(Request $request, $id)
126126
'fqdn', 'scheme', 'memory',
127127
'memory_overallocate', 'disk',
128128
'disk_overallocate', 'upload_size',
129-
'daemonBase', 'daemonSFTP',
130-
'daemonListen', 'reset_secret',
129+
'daemonSFTP', 'daemonListen', 'reset_secret',
131130
]));
132131
Alert::success('Successfully update this node\'s information. If you changed any daemon settings you will need to restart it now.')->flash();
133132

app/Repositories/NodeRepository.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ public function update($id, array $data)
100100
'disk' => 'numeric|min:1',
101101
'disk_overallocate' => 'numeric|min:-1',
102102
'upload_size' => 'numeric|min:0',
103-
'daemonBase' => 'regex:/^([\/][\d\w.\-\/]+)$/',
103+
'daemonBase' => 'sometimes|regex:/^([\/][\d\w.\-\/]+)$/',
104104
'daemonSFTP' => 'numeric|between:1,65535',
105105
'daemonListen' => 'numeric|between:1,65535',
106-
'reset_secret' => 'sometimes|accepted',
106+
'reset_secret' => 'sometimes|nullable|accepted',
107107
]);
108108

109109
// Run validator, throw catchable and displayable exception if it fails.
@@ -138,7 +138,7 @@ public function update($id, array $data)
138138
}
139139

140140
// Set the Secret
141-
if (isset($data['reset_secret'])) {
141+
if (isset($data['reset_secret']) && ! is_null($data['reset_secret'])) {
142142
$uuid = new UuidService;
143143
$data['daemonSecret'] = (string) $uuid->generate('nodes', 'daemonSecret');
144144
unset($data['reset_secret']);

0 commit comments

Comments
 (0)