Skip to content

Commit 449e44c

Browse files
authored
fix(oma-fetch): fix download file as symlink judge (#572)
1 parent 8789634 commit 449e44c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

oma-fetch/src/download.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,17 @@ impl<'a> SingleDownloader<'a> {
240240
trace!("{} download url is: {}", file.display(), source.url);
241241
let mut dest = None;
242242
let mut validator = None;
243+
let is_symlink = file.is_symlink();
243244

244-
if file.is_symlink() {
245+
debug!("file {} is symlink = {}", file.display(), is_symlink);
246+
247+
if is_symlink {
245248
tokio::fs::remove_file(&file).await.context(RemoveSnafu)?;
246249
}
247250

248251
// 如果要下载的文件已经存在,则验证 Checksum 是否正确,若正确则添加总进度条的进度,并返回
249252
// 如果不存在,则继续往下走
250-
if file_exist && !file.is_symlink() {
253+
if file_exist && !is_symlink {
251254
trace!(
252255
"File {} already exists, verifying checksum ...",
253256
self.entry.filename

0 commit comments

Comments
 (0)