MCPcopy Create free account
hub / github.com/decaporg/decap-cms / readFileMetadata

Method readFileMetadata

packages/decap-cms-backend-forgejo/src/API.ts:341–361  ·  view source on GitHub ↗
(path: string, sha: string | null | undefined)

Source from the content-addressed store, hash-verified

339 }
340
341 async readFileMetadata(path: string, sha: string | null | undefined) {
342 const fetchFileMetadata = async () => {
343 try {
344 const result: ReposListCommitsResponse = await this.request(
345 `${this.originRepoURL}/commits`,
346 {
347 params: { path, sha: this.branch, stat: 'false' },
348 },
349 );
350 const { commit } = result[0];
351 return {
352 author: commit.author.name || commit.author.email,
353 updatedOn: commit.author.date,
354 };
355 } catch (e) {
356 return { author: '', updatedOn: '' };
357 }
358 };
359 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
360 return fileMetadata;
361 }
362
363 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
364 const result: GitGetBlobResponse = await this.request(`${repoURL}/git/blobs/${sha}`, {

Callers

nothing calls this directly

Calls 1

readFileMetadataFunction · 0.90

Tested by

no test coverage detected