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

Method parseContentKey

packages/decap-cms-backend-forgejo/src/API.ts:297–315  ·  view source on GitHub ↗
(contentKey: string)

Source from the content-addressed store, hash-verified

295 }
296
297 parseContentKey(contentKey: string) {
298 if (!this.useOpenAuthoring) {
299 return parseContentKey(contentKey);
300 }
301
302 const repoPrefix = `${this.repo}/`;
303 // Some content keys may be prefixed with the origin repo instead of the fork repo.
304 const originRepoPrefix = this.originRepo ? `${this.originRepo}/` : null;
305
306 let keyToParse = contentKey;
307
308 if (contentKey.startsWith(repoPrefix)) {
309 keyToParse = contentKey.slice(repoPrefix.length);
310 } else if (originRepoPrefix && contentKey.startsWith(originRepoPrefix)) {
311 keyToParse = contentKey.slice(originRepoPrefix.length);
312 }
313
314 return parseContentKey(keyToParse);
315 }
316
317 async readFile(
318 path: string,

Callers 2

API.spec.jsFile · 0.45

Calls 1

parseContentKeyFunction · 0.90

Tested by

no test coverage detected