(path: string, { repoURL = this.repoURL, branch = this.branch } = {})
| 500 | } |
| 501 | |
| 502 | async getFileSha(path: string, { repoURL = this.repoURL, branch = this.branch } = {}) { |
| 503 | // Normalize path by removing leading slash if present |
| 504 | const normalizedPath = path.startsWith('/') ? path.slice(1) : path; |
| 505 | const encodedPath = normalizedPath |
| 506 | .split('/') |
| 507 | .map(segment => encodeURIComponent(segment)) |
| 508 | .join('/'); |
| 509 | const result = (await this.request(`${repoURL}/contents/${encodedPath}`, { |
| 510 | params: { ref: branch }, |
| 511 | })) as { sha?: string }; |
| 512 | |
| 513 | if (result?.sha) { |
| 514 | return result.sha; |
| 515 | } |
| 516 | |
| 517 | throw new APIError('Not Found', 404, API_NAME); |
| 518 | } |
| 519 | |
| 520 | async deleteFiles(paths: string[], message: string) { |
| 521 | if (this.useOpenAuthoring) { |
no test coverage detected