From 9525ed35743a3823b530a70ab3431c4bfaa0642c Mon Sep 17 00:00:00 2001 From: Scott Anderson Date: Wed, 9 Sep 2020 10:14:09 -0600 Subject: [PATCH] hotfix: added flux latest redirect support to edge.js --- deploy/edge.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/deploy/edge.js b/deploy/edge.js index d27f4ed83..6112caefa 100644 --- a/deploy/edge.js +++ b/deploy/edge.js @@ -103,14 +103,14 @@ exports.handler = (event, context, callback) => { /////////////////////////////// Flux redirects /////////////////////////////// // Redirect flux guides and introduction based on latest InfluxDB version if (/v2/.test(latestVersions['influxdb'])) { - temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/guides\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/guides\//, `/influxdb/${latestVersions['influxdb']}/query-data/flux/`)); - temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/introduction\//, `/influxdb/${latestVersions['influxdb']}/query-data/get-started/`)); + temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//, `/influxdb/${latestVersions['influxdb']}/query-data/flux/`)); + temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//, `/influxdb/${latestVersions['influxdb']}/query-data/get-started/`)); } else { - temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/guides\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/guides\//, `/influxdb/${latestVersions['influxdb']}/flux/guides/`)); - temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\/introduction\//, `/influxdb/${latestVersions['influxdb']}/flux/`)); + temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/guides\//, `/influxdb/${latestVersions['influxdb']}/flux/guides/`)); + temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/introduction\//, `/influxdb/${latestVersions['influxdb']}/flux/`)); } // Redirect Flux stdlib and language sections to v2 Flux docs - temporaryRedirect(/\/flux\/v0\.[0-9]{1,2}\/(?:functions|stdlib|language)\//.test(request.uri), request.uri.replace(/\/flux\/v0\.[0-9]{1,2}\//, `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`)); + temporaryRedirect(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\/(?:functions|stdlib|language)\//.test(request.uri), request.uri.replace(/\/flux\/(?:v0\.[0-9]{1,2}|latest)\//, `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`)); // Redirect versionless and base version to v2 Flux docs temporaryRedirect(/^\/flux\/(?:v0\.[0-9]{1,2}\/|)$/.test(request.uri), `/influxdb/${latestVersions['influxdbv2']}/reference/flux/`);