Skip to content

Commit 77127f9

Browse files
Fix unified domain report no longer working
1 parent 0d581d0 commit 77127f9

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

resources/assets/js/components/DomainReport.js

+19-1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,24 @@ const UrlReport = {
140140
},
141141
};
142142

143+
function cleanCurlErrorMessage(address, message) {
144+
if (typeof message !== 'string') {
145+
return message;
146+
}
147+
148+
// Some cURL error messages include the URL which prevent us from using exact string comparison to tell if it's the same problem
149+
// So we'll remove those URLs before comparing the strings
150+
return message.replace('http://' + address, '').replace('https://' + address, '');
151+
}
152+
153+
function isSameError(address, report1, report2) {
154+
if (report1.type !== 'error' || report2.type !== 'error') {
155+
return false;
156+
}
157+
158+
return cleanCurlErrorMessage(report1.exception_message) === cleanCurlErrorMessage(report2.exception_message);
159+
}
160+
143161
export default {
144162
oninit(vnode) {
145163
vnode.state.showUnimportantDomain = false;
@@ -151,7 +169,7 @@ export default {
151169
return null;
152170
}
153171

154-
const sameError = vnode.attrs.httpReport.type === 'error' && vnode.attrs.httpsReport.type === 'error' && vnode.attrs.httpReport.exception_message === vnode.attrs.httpsReport.exception_message;
172+
const sameError = isSameError(vnode.attrs.address, vnode.attrs.httpReport, vnode.attrs.httpsReport);
155173

156174
let error;
157175

0 commit comments

Comments
 (0)