mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
[VD:Box,OneDrive] prevent duplicate creation of thumbnails of permanent mounts
This commit is contained in:
@@ -230,7 +230,7 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
throw new \Exception(elFinder::ERROR_REAUTH_REQUIRE);
|
||||
} else {
|
||||
$refresh_token = $this->token->data->refresh_token;
|
||||
$initialToken = empty($this->token->initialToken)? md5($this->options['client_id'] . $refresh_token) : $this->token->initialToken;
|
||||
$initialToken = $this->_bd_getInitialToken();
|
||||
}
|
||||
|
||||
$url = self::TOKEN_URL;
|
||||
@@ -601,12 +601,22 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
$this->tmp = $tmp;
|
||||
}
|
||||
if ($tmp) {
|
||||
$aTokenFile = $tmp . DIRECTORY_SEPARATOR . (empty($this->token->initialToken)? md5($this->options['client_id'] . $this->token->data->refresh_token) : $this->token->initialToken) . '.btoken';
|
||||
$aTokenFile = $tmp . DIRECTORY_SEPARATOR . $this->_bd_getInitialToken() . '.btoken';
|
||||
}
|
||||
}
|
||||
return $aTokenFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Initial Token (MD5 hash)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function _bd_getInitialToken()
|
||||
{
|
||||
return (empty($this->token->initialToken)? md5($this->options['client_id'] . (!empty($this->token->data->refresh_token)? $this->token->data->refresh_token : $this->token->data->access_token)) : $this->token->initialToken);
|
||||
}
|
||||
|
||||
/*********************************************************************/
|
||||
/* OVERRIDE FUNCTIONS */
|
||||
/*********************************************************************/
|
||||
@@ -850,6 +860,7 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
}
|
||||
}
|
||||
|
||||
$error = false;
|
||||
try {
|
||||
$this->token = json_decode($this->options['accessToken']);
|
||||
if ($this->aTokenFile = $this->_bd_getATokenFile()) {
|
||||
@@ -870,18 +881,27 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
$this->_bd_refreshToken();
|
||||
} catch (Exception $e) {
|
||||
$this->token = null;
|
||||
|
||||
return $this->setError($e->getMessage());
|
||||
$error = true;
|
||||
$this->setError($e->getMessage());
|
||||
}
|
||||
|
||||
if (empty($this->options['netkey'])) {
|
||||
// make net mount key
|
||||
$_tokenKey = isset($this->token->data->refresh_token) ? $this->token->data->refresh_token : $this->token->data->access_token;
|
||||
$this->netMountKey = md5(implode('-', array('box', $this->options['path'], $_tokenKey)));
|
||||
$this->netMountKey = $this->_bd_getInitialToken();
|
||||
} else {
|
||||
$this->netMountKey = $this->options['netkey'];
|
||||
}
|
||||
|
||||
$this->tmbPrefix = 'box' . base_convert($this->netMountKey, 10, 32);
|
||||
|
||||
if ($error) {
|
||||
if (empty($this->options['netkey'])) {
|
||||
// for delete thumbnail
|
||||
$this->netunmount();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// normalize root path
|
||||
if ($this->options['path'] == 'root') {
|
||||
$this->options['path'] = '/';
|
||||
@@ -899,8 +919,6 @@ class elFinderVolumeBox extends elFinderVolumeDriver
|
||||
|
||||
$this->rootName = $this->options['alias'];
|
||||
|
||||
$this->tmbPrefix = 'box' . base_convert($this->netMountKey, 10, 32);
|
||||
|
||||
// This driver dose not support `syncChkAsTs`
|
||||
$this->options['syncChkAsTs'] = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user