Skip to content

Commit

Permalink
fix #2403 アップロードファイルのAPIについてフルパスを取得する仕組み
Browse files Browse the repository at this point in the history
  • Loading branch information
dovanhung committed Sep 28, 2023
1 parent 03482a4 commit b51ad96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions plugins/baser-core/src/Utility/BcFileUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -920,6 +920,9 @@ public function getSaveDir(bool $isTheme = false, bool $limited = false): string
$basePath = WWW_ROOT . 'files' . DS;
} else {
$request = Router::getRequest();

if (is_null($request)) return false;

$site = $request->getAttribute('currentSite');
if ($site && $site->theme) {
$basePath = ROOT . DS . 'plugins' . DS . $site->theme . DS . 'webroot' . DS . 'files' . DS;
Expand Down
2 changes: 1 addition & 1 deletion plugins/baser-core/src/View/Helper/BcUploadHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public function uploadImage($fieldName, $entity, $options = [])
$fileUrl = $this->getBasePath($settings);;
$fileUrlInTheme = $this->getBasePath($settings, true);
$saveDir = $this->table->getSaveDir(false, $options['limited']);
$saveDirInTheme = $this->table->getSaveDir(true, $options['limited']);
$saveDirInTheme = $this->table->getSaveDir(true, $options['limited']) ?? '';

$settingField = $fieldName;
if(strpos($fieldName, '.') !== false) {
Expand Down

0 comments on commit b51ad96

Please sign in to comment.