Open HungDV2022 opened 3 days ago
@HungDV2022 こちら細かく調査したのですが、次の条件を満たすことが正常な仕様となります。
◯ https://subdomain.localhost/ ◯ https://subdomain.localhost/subdomain (subdomainという固定ページを作る) ◯ https://localhost/baser/admin/baser-core/preview/view?url=https://subdomain.localhost/subdomain&preview=publish ✕ https://localhost/subdomain ◯ https://main.com/ ◯ https://main.com/main.com (main.comという固定ページを作る) ◯ https://localhost/baser/admin/baser-core/preview/view?url=https://main.com/main.com&preview=publish ✕ https://localhost/main.com
今回のプルリクでは上記の条件を満たせませんでした。
if (str_starts_with($url, '/' . $site->alias)) {
という条件分岐は、過去のコミットログを探したところ、プレビューのURLをうまくいかせるためのコードだったようですが、今でもうまくいっていないようでした。
正常な仕様を満たすコードは、検証したところ、str_starts_with の条件分岐を除外して次のようにすれば大丈夫でした。
if ($site->use_subdomain) {
$checkUrl = '/' . $site->alias . (($url) ? $url : '/');
} else {
$checkUrl = ($url)? $url : '/';
}
その上で、正常な仕様を満たすためのテストコードを書いて頂いてもいいですか?
@ryuring レビューをお願いします。