You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve lookup hints for private-address validation failures
Detect private/localhost URL validation failures and show actionable
hints instead of always suggesting authorized fetch.
- In lookup/traverse fetch failures, suggest -p/--allow-private-address
when the failure is a private-address UrlError.
- In recurse step failures, explain that recursive fetches always block
private/localhost targets and suggest best-effort suppression or
explicit non-recursive fetches.
- Keep existing -a/--authorized-fetch guidance for non-UrlError cases.
Also adds unit tests for the hint classification helper.
#608 (comment)#608 (comment)#608 (comment)
message`The URL appears to be private or localhost. Try with -p/--allow-private-address.`,
526
+
);
527
+
return;
528
+
case"recursive-private-address":
529
+
printError(
530
+
message`Recursive fetches do not allow private/localhost URLs. Use -S/--suppress-errors to skip blocked steps, or fetch those targets explicitly without --recurse.`,
531
+
);
532
+
return;
533
+
case"authorized-fetch":
534
+
printError(
535
+
message`It may be a private object. Try with -a/--authorized-fetch.`,
536
+
);
537
+
return;
538
+
}
539
+
}
540
+
494
541
/**
495
542
* Gets the next recursion target URL from an ActivityPub object.
496
543
*/
@@ -796,11 +843,7 @@ export async function runLookup(
796
843
handleTimeoutError(spinner,command.timeout,url);
797
844
}else{
798
845
spinner.fail(`Failed to fetch object: ${colors.red(url)}.`);
799
-
if(authLoader==null){
800
-
printError(
801
-
message`It may be a private object. Try with -a/--authorized-fetch.`,
802
-
);
803
-
}
846
+
printLookupFailureHint(authLoader,error);
804
847
}
805
848
awaitfinalizeAndExit(1);
806
849
return;
@@ -874,9 +917,7 @@ export async function runLookup(
874
917
}else{
875
918
spinner.fail("Failed to recursively fetch object.");
876
919
if(authLoader==null){
877
-
printError(
878
-
message`It may be a private object. Try with -a/--authorized-fetch.`,
0 commit comments