|
@@ -320,7 +320,20 @@ JsonCommander::Response JsonCommander::executeHead(const Json::Value &message) {
|
|
|
response.json["accept"] = false;
|
|
|
response.json["file"] = "";
|
|
|
response.json["data"] = "";
|
|
|
- response.json["error"] = "incorrect heaed command request";
|
|
|
+ response.json["error"] = "incorrect head command request";
|
|
|
+ } 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 {
|
|
|
+ response.json["accept"] = true;
|
|
|
+ response.json["file"] = message["file"];
|
|
|
+ response.json["data"] = base64::encodeVector(res);
|
|
|
+ response.json["error"] = "";
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return response;
|