diff --git a/src/protocols/docker.js b/src/protocols/docker.js index d7f5aba..6ccb7e5 100644 --- a/src/protocols/docker.js +++ b/src/protocols/docker.js @@ -130,7 +130,9 @@ function normalizeRepoPath(platformKey, repoPath) { * @returns {string} Repository path without the `/v2/` prefix or operation suffix. */ function extractRepositoryPath(apiPath) { - const normalizedPath = apiPath.startsWith('/v2/') ? apiPath.slice(4) : apiPath.replace(/^\/+/, ''); + const normalizedPath = apiPath.startsWith('/v2/') + ? apiPath.slice(4) + : apiPath.replace(/^\/+/, ''); const pathParts = normalizedPath.split('/').filter(Boolean); if (pathParts.length === 0 || pathParts[0].startsWith('_')) { @@ -228,10 +230,7 @@ export function responseUnauthorized(url, platform) { const realmPath = platform ? `/cr/${platform.slice(3)}/v2/auth` : '/v2/auth'; const headers = new Headers(); headers.set('Content-Type', 'application/json'); - headers.set( - 'WWW-Authenticate', - `Bearer realm="${url.origin}${realmPath}",service="Xget"` - ); + headers.set('WWW-Authenticate', `Bearer realm="${url.origin}${realmPath}",service="Xget"`); return new Response( JSON.stringify({ errors: [ diff --git a/test/unit/protocols.test.js b/test/unit/protocols.test.js index 2d50c15..48a61df 100644 --- a/test/unit/protocols.test.js +++ b/test/unit/protocols.test.js @@ -198,9 +198,7 @@ describe('Docker Authentication', () => { const response = await worker.fetch(request, {}, executionContext); expect(response.status).toBe(200); - expect(String(fetchSpy.mock.calls[1][0])).toContain( - 'scope=repository%3Aprivate%2Frepo%3Apull' - ); + expect(String(fetchSpy.mock.calls[1][0])).toContain('scope=repository%3Aprivate%2Frepo%3Apull'); }); });