|
@@ -322,17 +322,17 @@ JsonCommander::Response JsonCommander::executeHead(const Json::Value &message) {
|
|
response.json["data"] = "";
|
|
response.json["data"] = "";
|
|
response.json["error"] = "incorrect head command request";
|
|
response.json["error"] = "incorrect head command request";
|
|
} else {
|
|
} else {
|
|
- std::vector<char> res = fileManager.getBytesFromFile(message["file"].asString(), 4);
|
|
|
|
- if (res.size() == 0) {
|
|
|
|
- response.json["accept"] = false;
|
|
|
|
- response.json["file"] = "";
|
|
|
|
- response.json["data"] = "";
|
|
|
|
- response.json["error"] = "error while reading from file";
|
|
|
|
- } else {
|
|
|
|
|
|
+ std::pair<std::vector<char>,std::string>res = fileManager.getBytesFromFile(message["file"].asString(), 4);
|
|
|
|
+ if (res.second == "") {
|
|
response.json["accept"] = true;
|
|
response.json["accept"] = true;
|
|
response.json["file"] = message["file"];
|
|
response.json["file"] = message["file"];
|
|
- response.json["data"] = base64::encodeVector(res);
|
|
|
|
|
|
+ response.json["data"] = base64::encodeVector(res.first);
|
|
response.json["error"] = "";
|
|
response.json["error"] = "";
|
|
|
|
+ } else {
|
|
|
|
+ response.json["accept"] = true;
|
|
|
|
+ response.json["file"] = message["file"];
|
|
|
|
+ response.json["data"] ="";
|
|
|
|
+ response.json["error"] = res.second;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|