Fix relative URLs in form actions and other HTML attributes

This commit is contained in:
Kijin Sung 2020-06-17 18:38:26 +09:00
parent 3bbb175cd1
commit 480635d131

View file

@ -204,10 +204,13 @@ class HTMLDisplayHandler
// handles a relative path generated by using the rewrite module
if(Context::isAllowRewrite())
{
$pattern = '/src=("|\'){1}(?:\.\/)?((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)("|\'){1}/s';
$pattern = '/(action|src|href)=(["\'])\.\/([^"\']*)(["\'])/s';
$output = preg_replace($pattern, '$1=$2' . \RX_BASEURL . '$3$4', $output);
$pattern = '/src=(["\'])((?:files\/(?:attach|cache|faceOff|member_extra_info|thumbnails)|addons|common|(?:m\.)?layouts|modules|widgets|widgetstyle)\/[^"\']+)(["\'])/s';
$output = preg_replace($pattern, 'src=$1' . \RX_BASEURL . '$2$3', $output);
$pattern = '/href=("|\'){1}(\?[^"\']+)/s';
$pattern = '/href=(["\'])(\?[^"\']+)/s';
$output = preg_replace($pattern, 'href=$1' . \RX_BASEURL . '$2', $output);
if(Context::get('vid'))