Skip to content

Commit

Permalink
Fix space problems
Browse files Browse the repository at this point in the history
  • Loading branch information
maartendekeizer authored Feb 5, 2018
1 parent c30fd43 commit f1993ec
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,9 @@ public function resizeImageAction(Request $request, $path, $size, $checksum)
if (file_exists($targetDir) === false)
mkdir($targetDir, 0775, true);

$expectedChecksum = substr(sha1(str_replace([' '], ['%20'], $webPath) . $size . $this->app['imagine.secret']), 0, 10);
if ($expectedChecksum !== $checksum)
$expectedChecksum1 = substr(sha1(str_replace([' '], ['%20'], $webPath) . $size . $this->app['imagine.secret']), 0, 10);
$expectedChecksum2 = substr(sha1($webPath . $size . $this->app['imagine.secret']), 0, 10);
if ($expectedChecksum1 !== $checksum && $expectedChecksum2 !== $checksum)
throw new NotFoundHttpException('Invalid checksum');

$sizeArray = explode('x', $size);
Expand All @@ -50,4 +51,4 @@ public function resizeImageAction(Request $request, $path, $size, $checksum)

return new RedirectResponse($this->app['imagine.thumbnail_url'] . $size . '/' . $checksum . '/' . $webPath, RedirectResponse::HTTP_TEMPORARY_REDIRECT);
}
}
}

0 comments on commit f1993ec

Please sign in to comment.