Skip to content

Commit deccfde

Browse files
author
Tortue Torche
committed
Fix the except behavior of VerifyJavascriptResponse middleware.
1 parent 8aece27 commit deccfde

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/Efficiently/JqueryLaravel/VerifyJavascriptResponse.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,17 @@ public function __construct()
3737
public function handle($request, Closure $next)
3838
{
3939
$response = $next($request);
40-
if (! $this->shouldPassThrough($request) ||
41-
($this->isReading($request) && $this->nonXhrJavascriptResponse($request, $response))
42-
) {
43-
$crossOriginJavascriptWarning = "Security warning: an embedded " .
44-
"<script> tag on another site requested protected JavaScript. " .
45-
"If you know what you're doing, go ahead and disable CSRF " .
46-
"protection on this action to permit cross-origin JavaScript embedding.";
40+
if (! $this->shouldPassThrough($request)) {
41+
if ($this->isReading($request) &&
42+
$this->nonXhrJavascriptResponse($request, $response)
43+
) {
44+
$crossOriginJavascriptWarning = "Security warning: an embedded " .
45+
"<script> tag on another site requested protected JavaScript. " .
46+
"If you know what you're doing, go ahead and disable CSRF " .
47+
"protection on this action to permit cross-origin JavaScript embedding.";
4748

48-
throw new CrossOriginRequestException($crossOriginJavascriptWarning);
49+
throw new CrossOriginRequestException($crossOriginJavascriptWarning);
50+
}
4951
}
5052

5153
return $response;

0 commit comments

Comments
 (0)