diff --git a/source/install/nsp.cpp b/source/install/nsp.cpp index 86703b5..ecafa2b 100644 --- a/source/install/nsp.cpp +++ b/source/install/nsp.cpp @@ -83,14 +83,18 @@ namespace tin::install::nsp { const PFS0FileEntry* fileEntry = this->GetFileEntry(i); std::string name(this->GetFileEntryName(fileEntry)); - + auto foundExtension = name.substr(name.find(".") + 1); + // fix cert filname extension becoming corrupted when xcz/nsz is installing certs/ticks. - int pos = 0; - std::string mystr = name; - pos = mystr.find_last_of('.'); - mystr = mystr.substr(5, pos); - //auto foundExtension = name.substr(name.find(".") + 1); - auto foundExtension = mystr.substr(mystr.find(".") + 1); + std::string cert ("cert"); + std::size_t found = name.find(cert); + if (found!=std::string::npos){ + int pos = 0; + std::string mystr = name; + pos = mystr.find_last_of('.'); + mystr = mystr.substr(5, pos); + foundExtension = mystr.substr(mystr.find(".") + 1); + } if (foundExtension == extension) entryList.push_back(fileEntry); diff --git a/source/install/xci.cpp b/source/install/xci.cpp index ef54b4a..254bb02 100644 --- a/source/install/xci.cpp +++ b/source/install/xci.cpp @@ -158,15 +158,19 @@ namespace tin::install::xci { const HFS0FileEntry* fileEntry = this->GetFileEntry(i); std::string name(this->GetFileEntryName(fileEntry)); - + auto foundExtension = name.substr(name.find(".") + 1); + // fix cert filname extension becoming corrupted when xcz/nsz is installing certs/ticks. - int pos = 0; - std::string mystr = name; - pos = mystr.find_last_of('.'); - mystr = mystr.substr(5, pos); - //auto foundExtension = name.substr(name.find(".") + 1); - auto foundExtension = mystr.substr(mystr.find(".") + 1); - + std::string cert ("cert"); + std::size_t found = name.find(cert); + if (found!=std::string::npos){ + int pos = 0; + std::string mystr = name; + pos = mystr.find_last_of('.'); + mystr = mystr.substr(5, pos); + foundExtension = mystr.substr(mystr.find(".") + 1); + } + if (foundExtension == extension) entryList.push_back(fileEntry); }