Do not escape upload path in PrusaConnectNew init_upload

This commit is contained in:
David Kocik 2024-05-06 14:22:53 +02:00
parent f6e8a1e898
commit 2de65cfa6a

View File

@ -90,8 +90,8 @@ bool PrusaConnectNew::init_upload(PrintHostUpload upload_data, std::string& out)
const std::string name = get_name();
const std::string file_size = std::to_string(size);
const std::string access_token = GUI::wxGetApp().plater()->get_user_account()->get_access_token();
const std::string escaped_upload_path = escape_path_by_element(upload_data.upload_path);
const std::string escaped_upload_filename = escape_path_by_element(upload_data.upload_path.filename());
const std::string upload_path = upload_data.upload_path.generic_string();
const std::string upload_filename = upload_data.upload_path.filename().string();
std::string url = GUI::format("%1%/app/users/teams/%2%/uploads", get_host(), m_team_id);
const std::string request_body_json = GUI::format(
"{"
@ -101,9 +101,9 @@ bool PrusaConnectNew::init_upload(PrintHostUpload upload_data, std::string& out)
"\"force\": true, "
"\"printer_uuid\": \"%4%\""
"}"
, escaped_upload_filename
, upload_filename
, file_size
, upload_data.storage + "/" + escaped_upload_path
, upload_data.storage + "/" + upload_path
, m_uuid
);
@ -156,7 +156,7 @@ bool PrusaConnectNew::upload(PrintHostUpload upload_data, ProgressFn progress_fn
}
const std::string name = get_name();
const std::string access_token = GUI::wxGetApp().plater()->get_user_account()->get_access_token();
const std::string escaped_upload_path = escape_string(upload_data.storage + "/" + upload_data.upload_path.string());
const std::string escaped_upload_path = upload_data.storage + "/" + escape_path_by_element(upload_data.upload_path.string());
const std::string to_print = upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false";
const std::string to_queue = upload_data.post_action == PrintHostPostUploadAction::QueuePrint ? "true" : "false";
std::string url = GUI::format("%1%/app/teams/%2%/files/raw?upload_id=%3%&force=true&printer_uuid=%4%&path=%5%&to_print=%6%&to_queue=%7%", get_host(), m_team_id, upload_id, m_uuid, escaped_upload_path, to_print, to_queue);