mirror of
https://github.com/humhub/humhub.git
synced 2025-01-17 14:18:27 +01:00
Fix read image URLs with token param (#5027)
This commit is contained in:
parent
4558d2ac91
commit
01d07e2936
@ -248,8 +248,8 @@ class DownloadAction extends Action
|
||||
} catch (\Exception $ex) {
|
||||
Yii::warning('Could not decode provided JWT token. ' . $ex->getMessage());
|
||||
}
|
||||
if (!empty($decoded['sub']) && !empty($decoded['aud']) && $decoded['aud'] == $file->id) {
|
||||
return User::findOne(['id' => $decoded['sub']]);
|
||||
if (!empty($decoded->sub) && !empty($decoded->aud) && $decoded->aud == $file->id) {
|
||||
return User::findOne(['id' => $decoded->sub]);
|
||||
}
|
||||
|
||||
return null;
|
||||
@ -266,7 +266,7 @@ class DownloadAction extends Action
|
||||
{
|
||||
$token = [
|
||||
'iss' => 'dld-token-v1',
|
||||
'sub' => Yii::$app->user->id,
|
||||
'sub' => $user->id,
|
||||
'aud' => $file->id
|
||||
];
|
||||
return JWT::encode($token, static::getDownloadTokenKey());
|
||||
|
Loading…
x
Reference in New Issue
Block a user