Merge pull request #486 from Its-treason/fix/r-replace-not-a-function

fix(#382): TypeError r.replace is not a function
This commit is contained in:
Anoop M D 2023-10-09 21:31:33 +05:30 committed by GitHub
commit 33da3a1303
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,13 @@ const QueryResult = ({ item, collection, data, width, disableRunEventListener, h
}; };
const activeResult = useMemo(() => { const activeResult = useMemo(() => {
if (tab === 'preview' && mode.includes('html') && item.requestSent && item.requestSent.url) { if (
tab === 'preview' &&
mode.includes('html') &&
item.requestSent &&
item.requestSent.url &&
typeof data === 'string'
) {
// Add the Base tag to the head so content loads properly. This also needs the correct CSP settings // Add the Base tag to the head so content loads properly. This also needs the correct CSP settings
const webViewSrc = data.replace('<head>', `<head><base href="${item.requestSent.url}">`); const webViewSrc = data.replace('<head>', `<head><base href="${item.requestSent.url}">`);
return ( return (