Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR の目的
「ブラウザで(URLを)開く」機能を改善します。
カテゴリ
PR の背景
#1702 セキュリティ問題を起こしやすいShellExecute関数を直接呼ばないようにリファクタリングする
↓
#1705 クリッカブルURL機能から実行可能ファイルを直接実行できるのは仕様かどうか
↓
関連付けられたプログラム(ブラウザ)で開くという機能定義から見て
仕様ではなさそうなので、不具合として対処します。
PR のメリット
URLが含まれるテキストの編集中に意図せずプログラムを実行してしまう事態を防止できます。
PR のデメリット (トレードオフとかあれば)
従来の挙動を便利に活用していた人が困るかも知れません。
仕様・動作説明
変更点1、ブラウズ機能から OpenWithBrowser を呼び出す際にローカルファイルパスをそのまま渡していたのを、「file:///」プレフィックスを付けて渡すように変更します。
変更点2、OpenWithBrowserのパラメータ仕様を変更します。変更前はURLとUNCパス、ローカルのフルパスを受け付けていましたが、変更後はURLのみを受け付けるようにします。また、従来は指定されたURLをそのままシェルに渡していましたが、変更後はWindowsのURL解析機能を呼び出してURLスキームをチェックし、「file」プロトコルを開くときに「http」プロトコルに関連付けられたプログラムを使うように変更します。
PR の影響範囲
※従来はbatやcmdの編集中に「ブラウズ」でスクリプト実行できていました。(これも不具合)
※ブラウザ上で動くjavascriptの実行確認は可能です。
※httpプロトコルに関連付けられたプログラムでexeを開くと対象ファイルが「ダウンロード」されます。
※表示するつもりでダウンロードファイルが増えると悲しいので、exeは失敗扱いにします。
関連 issue, PR
resolve #1705
参考資料
https://www.glamenv-septzen.net/view/695#ide5cdab
https://newoldthing.wordpress.com/2007/03/23/how-does-your-browsers-know-that-its-not-the-default-browser/