diff --git a/lib/server/versionFallback.js b/lib/server/versionFallback.js index 5d1de3253d..8cdbdd4636 100644 --- a/lib/server/versionFallback.js +++ b/lib/server/versionFallback.js @@ -8,7 +8,6 @@ */ const CWD = process.cwd(); -const semver = require("semver"); const glob = require("glob"); const fs = require("fs"); const path = require("path"); @@ -102,8 +101,14 @@ files.forEach(file => { // returns the version to use for a document based on its id and // what the requested version is function docVersion(id, req_version) { + // iterate through versions until a version less than or equal to the requested + // is found, then check if that verison has an available file to use + let requestedFound = false; for (let i = 0; i < versions.length; i++) { - if (semver.gt(versions[i], req_version)) { + if (versions[i] === req_version) { + requestedFound = true; + } + if (!requestedFound) { continue; } if (!available[id]) { @@ -214,8 +219,14 @@ function docData() { // return the version of the sidebar to use given a requested version function sidebarVersion(req_version) { + // iterate through versions until a version less than or equal to the requested + // is found, then check if that verison has an available file to use + let requestedFound = false; for (let i = 0; i < versions.length; i++) { - if (semver.gt(versions[i], req_version)) { + if (versions[i] === req_version) { + requestedFound = true; + } + if (!requestedFound) { continue; } if (