Added more validation of files received in GET /data/file/frompeer

This commit is contained in:
CalDescent 2021-06-21 19:03:34 +01:00
parent 787ef957d2
commit 1613375cc0

View File

@ -262,6 +262,10 @@ public class DataResource {
}
DataFileMessage dataFileMessage = (DataFileMessage) message;
dataFile = dataFileMessage.getDataFile();
if (dataFile == null || !dataFile.exists()) {
throw ApiExceptionFactory.INSTANCE.createException(request, ApiError.FILE_NOT_FOUND);
}
return Response.ok(String.format("Received file %s, size %d bytes", dataFileMessage.getDataFile(), dataFileMessage.getDataFile().size())).build();
} catch (ApiException e) {