Merge pull request #2 from sy-records/fix-no-local-file

fix path = .
pull/6/head
Luffy 2020-04-12 10:05:32 +08:00 committed by GitHub
commit 6580bc31ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -281,8 +281,8 @@ add_action('delete_attachment', 'oss_delete_remote_attachment');
// 当upload_path为根目录时需要移除URL中出现的“绝对路径”
function oss_modefiy_img_url($url, $post_id)
{
$home_path = str_replace(array('/', '\\'), array('', ''), get_home_path());
$url = str_replace($home_path, '', $url);
// 移除 ./ 和 项目根路径
$url = str_replace(array('./', get_home_path()), array('', ''), $url);
return $url;
}