Skip to content

Commit

Permalink
Merge pull request #612 from nain-F49FF806/patch-1
Browse files Browse the repository at this point in the history
Ensure patch version is provided if accessing versioned documentation
  • Loading branch information
MarcoIeni authored Nov 18, 2024
2 parents 1479b01 + 05bd2ad commit a6db197
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion terragrunt/accounts/legacy/releases-prod/deployed-ref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4dcb58ebff4652004a5dc37194b97dee70d30aa3
5d176695f544340e137607f4cc2532429e242761
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,16 @@ exports.handler = (event, context, callback) => {
return temp_redirect('https://www.rust-lang.org/learn', callback);
}

// Forward versioned documentation as-is.
if (/^\/\d/.test(request.uri)) {
// Forward patch versioned documentation as-is.
if (/^\/(\d+)\.(\d+).(\d+)\/(.*)/.test(request.uri)) {
return callback(null, request);
}
// Include patch version 0 if minor versioned documentation is requested
const minor_versioned_pattern = /^\/(\d+)\.(\d+)\/(.*)/
if (minor_versioned_pattern.test(request.uri)) {
const patched_uri = request.uri.replace(minor_versioned_pattern, "/$1.$2.0/$3");
return temp_redirect(patched_uri, callback);
}

for (let i = 0; i < CRATE_REDIRECTS.length; i++) {
const crate = CRATE_REDIRECTS[i];
Expand Down

0 comments on commit a6db197

Please sign in to comment.