Skip to content

Commit

Permalink
fix: api模板目录不存在时, 无法保存模板问题
Browse files Browse the repository at this point in the history
  • Loading branch information
slowlyo committed Jun 6, 2024
1 parent a789dc4 commit a861a3e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Controllers/DevTools/ApiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ public function addTemplate()
admin_abort_if(is_file($file) && !request('overlay'), admin_trans('admin.apis.template_exists'));

try {
$dir = dirname($file);

if(!is_dir($dir)){
app('files')->makeDirectory($dir, 0755, true);
}

app('files')->put($file, $template);
} catch (\Throwable $e) {
return $this->response()->fail(admin_trans('admin.save_failed'));
Expand Down

0 comments on commit a861a3e

Please sign in to comment.