diff --git a/public/.htaccess b/public/.htaccess index f4b7c9d..6514559 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,5 +1,8 @@ RewriteEngine on RewriteBase / +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d [OR] +RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /index.html [L] diff --git a/src/common/lib/XoopsCode.tsx b/src/common/lib/XoopsCode.tsx index 2df7e14..033d295 100644 --- a/src/common/lib/XoopsCode.tsx +++ b/src/common/lib/XoopsCode.tsx @@ -90,8 +90,9 @@ const transform = (node: object, idx: number): ReactElement | null | void => { const download = (node_.attribs && node_.attribs['download']) || ''; const rel = (node_.attribs && node_.attribs['rel']) || ''; const klass = (node_.attribs && node_.attribs['class']) || ''; + const target = (node_.attribs && node_.attribs['target']) || ''; const isFile = download !== '' || /\.(zip|pdf|png|gif|jpg|gz|bz2|xz|mpg|mp3|mp4)$/i.test(url); - const isExternal = /external/.test(rel) || /external/.test(klass) || /^(mailto|https?:?\/\/)/.test(url); + const isExternal = /^(_blank|_top|_parent)$/.test(target) || /external/.test(rel) || /external/.test(klass) || /^(mailto|https?:?\/\/)/.test(url); if (!isFile && !isExternal) { const style = (node_.attribs && node_.attribs['style']) || ''; const title = (node_.attribs && node_.attribs['title']) || null;