1
0
Fork 0

fix incorrect "id" return type (must be string, not a number) (#2623)

This commit is contained in:
Jan 2017-06-21 10:26:04 +02:00 committed by Mark
parent ddb093527d
commit 55f16b0651
1 changed files with 8 additions and 2 deletions

View File

@ -104,14 +104,20 @@ arangodb::Result Database::info(TRI_vocbase_t* vocbase, VPackBuilder& result) {
VPackObjectBuilder b(&result);
result.add("name", value.get("name"));
result.add("id", value.get("id"));
if (value.get("id").isString()) {
result.add("id", value.get("id"));
} else if (value.get("id").isNumber()) {
result.add("id", VPackValue(std::to_string(value.get("id").getUInt())));
} else {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_INTERNAL, "unexpected type for 'id' attribute");
}
result.add("path", value.get("none"));
result.add("isSystem", VPackValue(name[0] == '_'));
}
} else {
VPackObjectBuilder b(&result);
result.add("name", VPackValue(vocbase->name()));
result.add("id", VPackValue(vocbase->id()));
result.add("id", VPackValue(std::to_string(vocbase->id())));
result.add("path", VPackValue(vocbase->path()));
result.add("isSystem", VPackValue(vocbase->isSystem()));
}