@@ -51,17 +51,28 @@ function extractSignedUrlsFromHtml(bodyHtml: string): Map<string, string> {
5151 // Extract signed URLs from HTML
5252 const signedUrlRegex = / h t t p s : \/ \/ p r i v a t e - u s e r - i m a g e s \. g i t h u b u s e r c o n t e n t \. c o m \/ [ ^ " ' \s ] + \? j w t = [ ^ " ' \s ] + / g;
5353 const signedUrls = bodyHtml . match ( signedUrlRegex ) || [ ] ;
54+ console . log ( `Found ${ signedUrls . length } signed URLs in HTML` ) ;
5455
5556 // Extract original URLs from HTML (both in markdown and HTML img tags)
5657 const originalUrlRegex = / h t t p s : \/ \/ g i t h u b \. c o m \/ u s e r - a t t a c h m e n t s \/ ( a s s e t s | f i l e s ) \/ [ ^ " ' \s ) ] + / g;
5758 const originalUrls = bodyHtml . match ( originalUrlRegex ) || [ ] ;
59+ console . log ( `Found ${ originalUrls . length } original attachment URLs in HTML` ) ;
60+
61+ if ( originalUrls . length > 0 ) {
62+ console . log ( 'Original URLs:' , originalUrls ) ;
63+ }
64+ if ( signedUrls . length > 0 && originalUrls . length === 0 ) {
65+ console . warn ( 'Found signed URLs but no original URLs - this is unexpected' ) ;
66+ console . log ( 'HTML sample:' , bodyHtml . substring ( 0 , 300 ) ) ;
67+ }
5868
5969 // Map original URLs to signed URLs (they appear in the same order in HTML)
6070 for ( let i = 0 ; i < Math . min ( originalUrls . length , signedUrls . length ) ; i ++ ) {
6171 const original = originalUrls [ i ] ;
6272 const signed = signedUrls [ i ] ;
6373 if ( original && signed ) {
6474 urlMap . set ( original , signed ) ;
75+ console . log ( `Mapped: ${ original } -> signed URL` ) ;
6576 }
6677 }
6778
0 commit comments