Commit a6d76d6
committed
gh-137586: Fix MacOS plist fallback, builtins.open shadow, add Brave
Return 'com.apple.Safari' instead of None when the LaunchServices plist is
absent (fresh installs never write it). None caused the non-http branch to
fall back to bare '/usr/bin/open <url>', bypassing -b and triggering the OS
file handler. Addresses gpshead's CHANGES_REQUESTED.
Fix infinite recursion: webbrowser's module-level open() shadowed
builtins.open, so open(plist, 'rb') called webbrowser.open() recursively
on every non-http/https URL. Use builtins.open() explicitly.
Narrow 'except Exception' to '(OSError, KeyError, ValueError)'. Addresses
hugovk's review comment.
Add 'brave browser': 'com.brave.Browser' to _BUNDLE_IDS and register it
so webbrowser.get('brave') works and Brave uses precise -b dispatch instead
of the name-based -a fallback.
Tested locally against Safari, Chrome, Firefox, Opera, Edge, and Brave
with https, http, and file:// URLs. 29/29 checks pass.1 parent aacbceb commit a6d76d6
2 files changed
Lines changed: 14 additions & 26 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
359 | | - | |
| 359 | + | |
360 | 360 | | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
364 | | - | |
365 | | - | |
366 | | - | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
377 | | - | |
378 | 364 | | |
379 | 365 | | |
380 | 366 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| 501 | + | |
501 | 502 | | |
502 | 503 | | |
503 | 504 | | |
| |||
620 | 621 | | |
621 | 622 | | |
622 | 623 | | |
623 | | - | |
624 | | - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
625 | 629 | | |
626 | | - | |
| 630 | + | |
627 | 631 | | |
628 | 632 | | |
629 | 633 | | |
630 | 634 | | |
631 | 635 | | |
632 | | - | |
| 636 | + | |
633 | 637 | | |
634 | 638 | | |
635 | 639 | | |
636 | 640 | | |
637 | 641 | | |
638 | | - | |
| 642 | + | |
639 | 643 | | |
640 | | - | |
| 644 | + | |
641 | 645 | | |
642 | 646 | | |
643 | 647 | | |
| |||
662 | 666 | | |
663 | 667 | | |
664 | 668 | | |
| 669 | + | |
665 | 670 | | |
666 | 671 | | |
667 | 672 | | |
| |||
673 | 678 | | |
674 | 679 | | |
675 | 680 | | |
676 | | - | |
677 | | - | |
678 | | - | |
679 | | - | |
| 681 | + | |
680 | 682 | | |
681 | 683 | | |
682 | 684 | | |
| |||
0 commit comments