Update Nextcloud.php (#2662)

It seems the try in the getInternalUsername function
was not placed very well, so the throw exception in the
ocs_request function didn't work.
This commit is contained in:
Neozlag
2022-01-25 10:15:08 +01:00
committed by GitHub
parent 7942f54a9f
commit 52af627f2b
@@ -280,15 +280,14 @@ class Nextcloud extends Base implements IBackupProvider
public function getInternalUsername($url, $username, $password): string
{
$xml_response = $this->ocs_request(
"$url/ocs/v1.php/cloud/user",
$username,
$password,
"GET",
"Cannot get real username"
);
try {
$xml_response = $this->ocs_request(
"$url/ocs/v1.php/cloud/user",
$username,
$password,
"GET",
"Cannot get real username"
);
$data = $xml_response->data;
if ($data == null) {
return $username; // no data found, return the old username