File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
cornucopia.owasp.org/script Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,10 +24,15 @@ async function fetchAndStreamNotFoundPage(resp) {
2424 const host = pathArray [ 2 ] ;
2525 const url = protocol + '//' + host + '/404' ;
2626 const { headers } = resp ;
27-
28- const response = await fetch ( url ) ;
29-
30- const html = ( await response . text ( ) ) . replace ( / \. \/ / gi, '/' ) . replace ( / i d = " b r e a d c r u m b s " c l a s s = " / gi, "id=\"breadcrumbs\" class=\"hide " ) ;
27+ let response ;
28+ let html ;
29+ if ( resp . url . includes ( '/cards/' ) && ( / [ a - z ] / . test ( path ) ) ) {
30+ response = await fetch ( protocol + "//" + host + "/cards/" + path . toUpperCase ( ) ) ;
31+ html = ( await response . text ( ) ) . replace ( / \. \. \/ / gi, "/" )
32+ } else {
33+ response = await fetch ( url ) ;
34+ html = ( await response . text ( ) ) . replace ( / \. \/ / gi, "/" ) . replace ( / i d = " b r e a d c r u m b s " c l a s s = " / gi, 'id="breadcrumbs" class="hide ' ) ;
35+ }
3136 return new Response ( html , {
3237 status : status ,
3338 statusText : statusText ,
You can’t perform that action at this time.
0 commit comments