From: Jay Freeman (saurik) Date: Wed, 15 Feb 2017 22:11:39 +0000 (-0800) Subject: Do not rely on specific filenames in source cells. X-Git-Tag: v1.1.29~1 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/018ea8acbdde7f5ee5d68c7431f9f514dcb27714?ds=inline Do not rely on specific filenames in source cells. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index a10181d2..a948174a 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1194,7 +1194,10 @@ class SourceStatus : } //printf("Set(%s, %s)\n", fetch ? "true" : "false", uri.c_str()); - [database_ setFetch:fetch forURI:uri.c_str()]; + + auto slash(uri.rfind('/')); + if (slash != std::string::npos) + [database_ setFetch:fetch forURI:uri.substr(0, slash).c_str()]; } _finline void Set(bool fetch, pkgAcquire::Item *item) { @@ -1659,13 +1662,10 @@ static void SaveConfig(NSObject *lock) { _profile(Source$setMetaIndex$DescURI) for (pkgAcquire::ItemIterator item(acquire.ItemsBegin()); item != acquire.ItemsEnd(); item++) { std::string file((*item)->DescURI()); - files_.insert(file); - if (file.length() < sizeof("Packages.bz2") || file.substr(file.length() - sizeof("Packages.bz2")) != "/Packages.bz2") + auto slash(file.rfind('/')); + if (slash == std::string::npos) continue; - file = file.substr(0, file.length() - 4); - files_.insert(file); - files_.insert(file + ".gz"); - files_.insert(file + "Index"); + files_.insert(file.substr(0, slash)); } _end