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

Method readFileMetadata

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

Source from the content-addressed store, hash-verified

289 }
290
291 async readFileMetadata(path: string, sha: string | null | undefined) {
292 const fetchFileMetadata = async () => {
293 try {
294 const result: ReposListCommitsResponse = await this.request(
295 `${this.originRepoURL}/commits`,
296 {
297 params: { path, sha: this.branch, stat: 'false' },
298 },
299 );
300 const { commit } = result[0];
301 return {
302 author: commit.author.name || commit.author.email,
303 updatedOn: commit.author.date,
304 };
305 } catch (e) {
306 return { author: '', updatedOn: '' };
307 }
308 };
309 const fileMetadata = await readFileMetadata(sha, fetchFileMetadata, localForage);
310 return fileMetadata;
311 }
312
313 async fetchBlobContent({ sha, repoURL, parseText }: BlobArgs) {
314 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