FIX: [STUDIO-4775] fix hide_passwd crash

Change-Id: I32224ee6af9f17cd4c448f519dcff65060ed7216
Jira: STUDIO-4775
This commit is contained in:
chunmao.guo 2023-10-13 16:33:28 +08:00 committed by Lane.Wei
parent 63c33c90e6
commit d6357d12b5
3 changed files with 7 additions and 4 deletions

View File

@ -410,7 +410,7 @@ void MediaFilePanel::modeChanged(wxCommandEvent& e1)
m_last_mode = mode;
}
extern wxString hide_passwd(wxString url, std::vector<std::string> const &passwords);
extern wxString hide_passwd(wxString url, std::vector<wxString> const &passwords);
void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
{

View File

@ -139,15 +139,18 @@ void MediaPlayCtrl::SetMachineObject(MachineObject* obj)
SetStatus("", false);
}
wxString hide_passwd(wxString url, std::vector<std::string> const &passwords)
wxString hide_passwd(wxString url, std::vector<wxString> const &passwords)
{
for (auto &p : passwords) {
auto i = url.find(p);
if (i == wxString::npos)
continue;
auto j = i + p.length();
if (p[p.length() - 1] == '=') {
i = j;
j = url.find('&', i);
if (j == wxString::npos) j = url.length();
if (j == wxString::npos)
j = url.length();
}
auto l = size_t(j - i);
if (j == url.length() || url[j] == '@' || url[j] == '&')

View File

@ -1218,7 +1218,7 @@ void PrinterFileSystem::HandleResponse(boost::unique_lock<boost::mutex> &l, Bamb
}
namespace Slic3r { namespace GUI {
extern wxString hide_passwd(wxString url, std::vector<std::string> const &passwords);
extern wxString hide_passwd(wxString url, std::vector<wxString> const &passwords);
}}
void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int result)