set empty pass will delete passfile

pull/194/head
qkqpttgf 2021-01-17 13:33:33 +08:00 committed by GitHub
parent 49e602e7e6
commit ecb2aad3bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -294,7 +294,11 @@ class Onedrive {
}
public function Encrypt($folder, $passfilename, $pass) {
$filename = path_format($folder['path'] . '/' . urlencode($passfilename));
$result = $this->MSAPI('PUT', $filename, $pass, $this->access_token);
if ($pass==='') {
$result = $this->MSAPI('DELETE', $filename, '', $this->access_token);
} else {
$result = $this->MSAPI('PUT', $filename, $pass, $this->access_token);
}
$path1 = $folder['path'];
if ($path1!='/'&&substr($path1, -1)=='/') $path1 = substr($path1, 0, -1);
savecache('path_' . $path1 . '/?password', '', $this->disktag, 1);
@ -912,4 +916,4 @@ class Onedrive {
return $response;
}
}
}