summaryrefslogtreecommitdiff
path: root/methods/file.cc
diff options
context:
space:
mode:
Diffstat (limited to 'methods/file.cc')
-rw-r--r--methods/file.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/methods/file.cc b/methods/file.cc
index 5d5fffa67..5c76ec122 100644
--- a/methods/file.cc
+++ b/methods/file.cc
@@ -58,7 +58,10 @@ bool FileMethod::Fetch(FetchItem *Itm)
{
HashStringList const hsl = Itm->ExpectedHashes;
if (Itm->ExpectedHashes.VerifyFile(File))
+ {
+ Res.Filename = Itm->DestFile;
Res.IMSHit = true;
+ }
}
}
}
@@ -78,7 +81,14 @@ bool FileMethod::Fetch(FetchItem *Itm)
if (filesize != 0 && filesize == Res.Size)
Res.IMSHit = true;
}
+
+ Hashes Hash(Itm->ExpectedHashes);
+ FileFd Fd(File, FileFd::ReadOnly);
+ Hash.AddFD(Fd);
+ Res.TakeHashes(Hash);
}
+ if (Res.IMSHit == false)
+ URIStart(Res);
// See if the uncompressed file exists and reuse it
FetchResult AltRes;
@@ -103,14 +113,6 @@ bool FileMethod::Fetch(FetchItem *Itm)
}
}
- if (Res.Filename.empty() == false)
- {
- Hashes Hash(Itm->ExpectedHashes);
- FileFd Fd(Res.Filename, FileFd::ReadOnly);
- Hash.AddFD(Fd);
- Res.TakeHashes(Hash);
- }
-
if (AltRes.Filename.empty() == false)
URIDone(Res,&AltRes);
else if (Res.Filename.empty() == false)