From eae97b1fd0099dc5cec0354f450d99cd800b15f1 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 14 Apr 2020 20:11:46 +0300 Subject: [PATCH] refactor(core): fix path for images tokens --- src/flextype/endpoints/delivery/images.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/flextype/endpoints/delivery/images.php b/src/flextype/endpoints/delivery/images.php index 9befbe85..0e6e9c55 100644 --- a/src/flextype/endpoints/delivery/images.php +++ b/src/flextype/endpoints/delivery/images.php @@ -49,10 +49,11 @@ $app->get('/api/delivery/images/{path:.+}', function (Request $request, Response // Validate delivery image token if (validate_delivery_images_token($token)) { - $delivery_images_token_file_path = PATH['site'] . '/site/delivery/images/' . $token . '/token.yaml'; + $delivery_images_token_file_path = PATH['site'] . '/tokens/delivery/images/' . $token . '/token.yaml'; // Set delivery token file if ($delivery_images_token_file_data = $flextype['parser']->decode(Filesystem::read($delivery_images_token_file_path), 'yaml')) { + if ($delivery_images_token_file_data['state'] === 'disabled' || ($delivery_images_token_file_data['limit_calls'] !== 0 && $delivery_images_token_file_data['calls'] >= $delivery_images_token_file_data['limit_calls'])) { return $response->withJson(['detail' => 'Incorrect authentication credentials.'], 401);