😎调整本地文件存储不用绝对路径

This commit is contained in:
zuohuaijun 2024-09-19 17:53:33 +08:00
parent 3b8d95c032
commit 92f0a6d700

View File

@ -417,11 +417,7 @@ public class SysFileService : IDynamicApiController, ITransient
await file.CopyToAsync(stream); await file.CopyToAsync(stream);
} }
// 生成外链 newFile.Url = $"{newFile.FilePath}/{newFile.Id + newFile.Suffix}";
var host = CommonUtil.GetLocalhost();
if (!host.EndsWith('/'))
host += "/";
newFile.Url = $"{host}{newFile.FilePath}/{newFile.Id + newFile.Suffix}";
} }
await _sysFileRep.AsInsertable(newFile).ExecuteCommandAsync(); await _sysFileRep.AsInsertable(newFile).ExecuteCommandAsync();
return newFile; return newFile;