X-Git-Url: https://git.saurik.com/apt.git/blobdiff_plain/e331f6edcb86e6acb2888ec0721e55bf43e10bc2..7bb525cb8a81e77923213a83039659ca375c4239:/methods/file.cc diff --git a/methods/file.cc b/methods/file.cc index 1b3183f05..bf7d380c5 100644 --- a/methods/file.cc +++ b/methods/file.cc @@ -1,6 +1,6 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: file.cc,v 1.6 1998/11/14 01:39:49 jgg Exp $ +// $Id: file.cc,v 1.9 2003/02/10 07:34:41 doogie Exp $ /* ###################################################################### File URI method for APT @@ -13,6 +13,7 @@ ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#include #include #include @@ -37,7 +38,9 @@ bool FileMethod::Fetch(FetchItem *Itm) URI Get = Itm->Uri; string File = Get.Path; FetchResult Res; - + if (Get.Host.empty() == false) + return _error->Error(_("Invalid URI, local URIS must not start with //")); + // See if the file exists struct stat Buf; if (stat(File.c_str(),&Buf) == 0) @@ -46,7 +49,7 @@ bool FileMethod::Fetch(FetchItem *Itm) Res.Filename = File; Res.LastModified = Buf.st_mtime; Res.IMSHit = false; - if (Itm->LastModified == Buf.st_mtime) + if (Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0) Res.IMSHit = true; } @@ -62,7 +65,7 @@ bool FileMethod::Fetch(FetchItem *Itm) AltRes.Filename = File; AltRes.LastModified = Buf.st_mtime; AltRes.IMSHit = false; - if (Itm->LastModified == Buf.st_mtime) + if (Itm->LastModified == Buf.st_mtime && Itm->LastModified != 0) AltRes.IMSHit = true; URIDone(Res,&AltRes); @@ -71,7 +74,7 @@ bool FileMethod::Fetch(FetchItem *Itm) } if (Res.Filename.empty() == true) - return _error->Error("File not found"); + return _error->Error(_("File not found")); URIDone(Res); return true;