aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-07-03 17:42:51 +0200
committerHampusM <hampus@hampusmat.com>2021-07-03 17:42:51 +0200
commit7ee871e391cd2d2057175d54767fc71e708e32eb (patch)
treedcdddccf980915e205a4c3a0c538bb50f5bed539 /packages/server/src
parentb2e8c2b464919cbd4ff471fcee8d8e63667f8a81 (diff)
Entries in the tree endpoint data contains name and not path & tree endpoint queries without a path gives you the root type
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/api/v1/repo/index.ts6
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/server/src/api/v1/repo/index.ts b/packages/server/src/api/v1/repo/index.ts
index c13e173..51413d6 100644
--- a/packages/server/src/api/v1/repo/index.ts
+++ b/packages/server/src/api/v1/repo/index.ts
@@ -4,6 +4,7 @@ import { Blob } from "../../../git/blob";
import { Repository } from "../../../git/repository";
import { Tag } from "../../../git/tag";
import { TreeEntry } from "../../../git/tree_entry";
+import { basename } from "path";
import branches from "./branches";
import log from "./log";
import { verifyRepoName } from "../../util";
@@ -32,7 +33,8 @@ function addHooks(fastify: FastifyInstance, opts: FastifyPluginOptions): void {
async function treeEntryMap(entry: TreeEntry) {
const latest_commit = await entry.latestCommit();
return {
- path: entry.path,
+ name: basename(entry.path),
+ type: entry.type,
latest_commit: {
id: latest_commit.id,
message: latest_commit.message,
@@ -80,7 +82,7 @@ export default function(fastify: FastifyInstance, opts: FastifyPluginOptions, do
return;
}
- reply.send({ data: await Promise.all(tree.entries().map(treeEntryMap)) });
+ reply.send({ data: { type: "tree", content: await Promise.all(tree.entries().map(treeEntryMap)) } });
}
});