diff options
Diffstat (limited to 'methods')
-rw-r--r-- | methods/cdrom.cc | 3 | ||||
-rw-r--r-- | methods/file.cc | 18 |
2 files changed, 12 insertions, 9 deletions
diff --git a/methods/cdrom.cc b/methods/cdrom.cc index 10cb29f66..67265cfa3 100644 --- a/methods/cdrom.cc +++ b/methods/cdrom.cc @@ -260,7 +260,8 @@ bool CDROMMethod::Fetch(FetchItem *Itm) struct stat Buf; if (stat(Res.Filename.c_str(),&Buf) != 0) return _error->Error(_("File not found")); - + + URIStart(Res); if (NewID.empty() == false) CurrentID = NewID; Res.LastModified = Buf.st_mtime; 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) |