File tree 1 file changed +19
-1
lines changed
resources/assets/js/components
1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ const UrlReport = {
140
140
} ,
141
141
} ;
142
142
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
+
143
161
export default {
144
162
oninit ( vnode ) {
145
163
vnode . state . showUnimportantDomain = false ;
@@ -151,7 +169,7 @@ export default {
151
169
return null ;
152
170
}
153
171
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 ) ;
155
173
156
174
let error ;
157
175
You can’t perform that action at this time.
0 commit comments