Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
MoLow committed Oct 19, 2023
1 parent 711e030 commit 7cd8e1b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,20 @@ export function mapUrlPathToBucketPath(
const mappedRelease = `${DIST_PATH_PREFIX}/${splitPath[3]}`;
const mappedDist = `${DIST_PATH_PREFIX}/${splitPath[2]}`;

if (splitPath[1] === "dist" && REDIRECT_MAP.has(mappedDist)) {
if (splitPath[1] === 'dist' && REDIRECT_MAP.has(mappedDist)) {
// All items in REDIRECT_MAP are three levels deep, that is asserted in tests
bucketPath = `${REDIRECT_MAP.get(mappedDist)}/${splitPath.slice(3).join('/')}`;
} else if (splitPath[1] === "docs" && REDIRECT_MAP.has(mappedDocs)) {
bucketPath = `${REDIRECT_MAP.get(mappedDist)}/${splitPath
.slice(3)
.join('/')}`;
} else if (splitPath[1] === 'docs' && REDIRECT_MAP.has(mappedDocs)) {
// All items in REDIRECT_MAP are three levels deep, that is asserted in tests
bucketPath = `${REDIRECT_MAP.get(mappedDocs)}/${splitPath.slice(3).join('/')}`;
} else if (splitPath[2] === "release" && REDIRECT_MAP.has(mappedRelease)) {
bucketPath = `${REDIRECT_MAP.get(mappedRelease)}/${splitPath.slice(4).join('/')}`;
bucketPath = `${REDIRECT_MAP.get(mappedDocs)}/${splitPath
.slice(3)
.join('/')}`;
} else if (splitPath[2] === 'release' && REDIRECT_MAP.has(mappedRelease)) {
bucketPath = `${REDIRECT_MAP.get(mappedRelease)}/${splitPath
.slice(4)
.join('/')}`;
} else if (basePath in urlToBucketPathMap) {
bucketPath = urlToBucketPathMap[basePath];
} else if (env.DIRECTORY_LISTING !== 'restricted') {
Expand Down Expand Up @@ -199,7 +205,7 @@ export function isExtensionless(path: string): boolean {
// heuristic here. There aren't any files that don't
// have file extensions, so, if there are no file extensions
// specified in the url, treat it like a directory.
// One exception is `latest-vXX.x`, which is a directory
// One exception is `latest-vXX.x`, which is a directory
return path.lastIndexOf('.') === -1 || path.toLowerCase().endsWith('.x');
}

Expand Down

0 comments on commit 7cd8e1b

Please sign in to comment.