修复下载后文件后缀丢失问题

This commit is contained in:
zyx0814
2024-07-22 12:04:35 +08:00
Unverified
parent 452b534945
commit 8c3a3caa1e
2 changed files with 8 additions and 0 deletions

View File

@@ -15,6 +15,10 @@ $appdata = C::t('pichome_vapp')->fetch($resourcesdata['appid']);
if(!C::t('pichome_vapp')->getpermbypermdata($appdata['download'],$resourcesdata['appid'],'download')){ if(!C::t('pichome_vapp')->getpermbypermdata($appdata['download'],$resourcesdata['appid'],'download')){
exit(lang('no_perm')); exit(lang('no_perm'));
} }
$extension = substr($resourcesdata['name'], strrpos($resourcesdata['name'], '.') + 1);
if($extension != $resourcesdata['ext']){
$resourcesdata['name'] = $resourcesdata['name'].'.'.$resourcesdata['ext'];
}
$resourcesdata['name'] = '"' . (strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'Edge') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($resourcesdata['name']) : ($resourcesdata['name'])) . '"'; $resourcesdata['name'] = '"' . (strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'Edge') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($resourcesdata['name']) : ($resourcesdata['name'])) . '"';
$attach = DB::fetch_first("select path,appid from %t where rid = %s",array('pichome_resources_attr',$rid)); $attach = DB::fetch_first("select path,appid from %t where rid = %s",array('pichome_resources_attr',$rid));
if(is_numeric($attach['path'])){ if(is_numeric($attach['path'])){

View File

@@ -15,6 +15,10 @@ $appdata = C::t('pichome_vapp')->fetch($resourcesdata['appid']);
if(!C::t('pichome_vapp')->getpermbypermdata($appdata['download'],$resourcesdata['appid'],'download')){ if(!C::t('pichome_vapp')->getpermbypermdata($appdata['download'],$resourcesdata['appid'],'download')){
exit(lang('no_perm')); exit(lang('no_perm'));
} }
$extension = substr($resourcesdata['name'], strrpos($resourcesdata['name'], '.') + 1);
if($extension != $resourcesdata['ext']){
$resourcesdata['name'] = $resourcesdata['name'].'.'.$resourcesdata['ext'];
}
$resourcesdata['name'] = '"' . (strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'Edge') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($resourcesdata['name']) : ($resourcesdata['name'])) . '"'; $resourcesdata['name'] = '"' . (strtolower(CHARSET) == 'utf-8' && (strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') || strexists($_SERVER['HTTP_USER_AGENT'], 'Edge') || strexists($_SERVER['HTTP_USER_AGENT'], 'rv:11')) ? urlencode($resourcesdata['name']) : ($resourcesdata['name'])) . '"';
$attach = DB::fetch_first("select path,appid from %t where rid = %s",array('pichome_resources_attr',$rid)); $attach = DB::fetch_first("select path,appid from %t where rid = %s",array('pichome_resources_attr',$rid));
if(is_numeric($attach['path'])){ if(is_numeric($attach['path'])){