Skip to content

Commit ca6cd4d

Browse files
committed
proxify: fixed case when src= is empty
1 parent 9d797fc commit ca6cd4d

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/Plugin/ProxifyPlugin.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ public function onCompleted(ProxyEvent $event){
128128

129129
$content_type = $response->headers->get('content-type');
130130

131-
// ugly hack but should fix most problems temporarily
131+
// DO NOT do any proxification on .js files
132132
if($content_type == 'text/javascript' || $content_type == 'application/javascript' || $content_type == 'application/x-javascript'){
133133
return;
134134
}
@@ -152,7 +152,14 @@ public function onCompleted(ProxyEvent $event){
152152

153153
// html .*? just in case href is empty...
154154
$str = preg_replace_callback('@href\s*=\s*(["\'])(.*?)\1@im', array($this, 'html_href'), $str);
155-
$str = preg_replace_callback('@src\s*=\s*(["|\'])([^\'"]+)\1@i', array($this, 'html_src'), $str);
155+
156+
157+
/*
158+
159+
src= can be empty - then what?
160+
161+
*/
162+
$str = preg_replace_callback('@src\s*=\s*(["|\'])(.*?)\1@i', array($this, 'html_src'), $str);
156163

157164
// sometimes form action is empty - which means a postback to the current page
158165
$str = preg_replace_callback('@<form[^>]*action=(["\'])(.*?)\1[^>]*>@i', array($this, 'form_action'), $str);

0 commit comments

Comments
 (0)