Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

サブフォルダにbaserCMSを設置時にフルパスが正しく取得できない問題 #1807

Closed
katokaisya opened this issue Mar 23, 2022 · 0 comments

Comments

@katokaisya
Copy link
Collaborator

案件で発生
サブフォルダに設置したbaserCMSにて
$image = $this->Blog->getPostImg($post, array('output' => 'url));
などで取得したURLを

$this->BcBaser->getUri($image);

でフルパスにしようとすると、
サブフォルダ名の前の「/」がなくなる。
($imageが /サブフォルダ名/files/画像パスの場合に発生する。)

上記にて生成されたURL:   http(s)://ドメインサブフォルダ名/パス
正しく生成された場合のURL: http(s)://ドメイン/サブフォルダ名/パス

該当ファイル: lib/Baser/View/Helper/BcAppHelper.php
該当メソッド名 : public function webroot($file) {}
該当箇所:

$asset[0] = preg_replace('/^\//', '', $asset[0]);
if ($this->request->webroot && $this->request->webroot != '/') {
	$filePath = preg_replace('/' . preg_quote($this->request->webroot, '/') . '/', '', $asset[0]);
} else {
	$filePath = $asset[0];
}
$filePath = str_replace('/', DS, $filePath);

一応 組込み側でも対応は可能

if ($this->request->webroot && $this->request->webroot != '/') {
	$image = str_replace($this->request->webroot, '/', $image);
}

@gondoh gondoh closed this as completed in bd7cd4b Mar 23, 2022
gondoh added a commit that referenced this issue Mar 23, 2022
fix #1807 サブフォルダにbaserCMSを設置時にフルパスが正しく取得できない問題を解決
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant