MCPcopy
hub / github.com/github/docs / getProxyPath

Function getProxyPath

middleware/archived-enterprise-versions.js:238–247  ·  view source on GitHub ↗
(reqPath, requestedVersion)

Source from the content-addressed store, hash-verified

236// for >=2.13: /2.13/en/enterprise/2.13/user/articles/viewing-contributions-on-your-profile
237// for <2.13: /2.12/user/articles/viewing-contributions-on-your-profile
238function getProxyPath(reqPath, requestedVersion) {
239 if (versionSatisfiesRange(requestedVersion, `>=${firstReleaseStoredInBlobStorage}`)) {
240 const newReqPath = reqPath.includes('redirects.json') ? `/${reqPath}` : reqPath + '/index.html'
241 return `${REMOTE_ENTERPRISE_STORAGE_URL}/${requestedVersion}${newReqPath}`
242 }
243 const proxyPath = versionSatisfiesRange(requestedVersion, `>=${firstVersionDeprecatedOnNewSite}`)
244 ? slash(path.join('/', requestedVersion, reqPath))
245 : reqPath.replace(/^\/enterprise/, '')
246 return `https://github.github.com/help-docs-archived-enterprise-versions${proxyPath}`
247}
248
249// Module-level global cache object.
250// Get's populated lazily inside getFallbackRedirect().

Callers 2

doGetFunction · 0.85

Calls 1

versionSatisfiesRangeFunction · 0.85

Tested by

no test coverage detected