File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -389,6 +389,10 @@ impl Checker {
389
389
390
390
/// Load a file from disk, or from the cache if available.
391
391
fn load_file ( & mut self , file : & Path , report : & mut Report ) -> ( String , & FileEntry ) {
392
+ // https://docs.microsoft.com/en-us/windows/win32/debug/system-error-codes--0-499-
393
+ #[ cfg( windows) ]
394
+ const ERROR_INVALID_NAME : i32 = 123 ;
395
+
392
396
let pretty_path =
393
397
file. strip_prefix ( & self . root ) . unwrap_or ( & file) . to_str ( ) . unwrap ( ) . to_string ( ) ;
394
398
@@ -405,6 +409,14 @@ impl Checker {
405
409
}
406
410
Err ( e) if e. kind ( ) == ErrorKind :: NotFound => FileEntry :: Missing ,
407
411
Err ( e) => {
412
+ // If a broken intra-doc link contains `::`, on windows, it will cause `ERROR_INVALID_NAME` rather than `NotFound`.
413
+ // Explicitly check for that so that the broken link can be allowed in `LINKCHECK_EXCEPTIONS`.
414
+ #[ cfg( windows) ]
415
+ if e. raw_os_error ( ) == Some ( ERROR_INVALID_NAME )
416
+ && file. as_os_str ( ) . to_str ( ) . map_or ( false , |s| s. contains ( "::" ) )
417
+ {
418
+ return FileEntry :: Missing ;
419
+ }
408
420
panic ! ( "unexpected read error for {}: {}" , file. display( ) , e) ;
409
421
}
410
422
} ) ;
You can’t perform that action at this time.
0 commit comments