You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by ti...@apache.org on 2023/03/02 06:49:41 UTC

[pulsar-site] branch main updated: fix: handle version=master case (#445)

This is an automated email from the ASF dual-hosted git repository.

tison pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/pulsar-site.git


The following commit(s) were added to refs/heads/main by this push:
     new 0b9a0de2eaf fix: handle version=master case (#445)
0b9a0de2eaf is described below

commit 0b9a0de2eafb9c54092eba49622ede169b7ac74f
Author: tison <wa...@gmail.com>
AuthorDate: Thu Mar 2 14:49:35 2023 +0800

    fix: handle version=master case (#445)
    
    Signed-off-by: tison <wa...@gmail.com>
---
 src/utils/index.js | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/utils/index.js b/src/utils/index.js
index 20861c6ddb4..1f164c9d3fd 100644
--- a/src/utils/index.js
+++ b/src/utils/index.js
@@ -55,13 +55,13 @@ export function setVersion(version) {
 
 export function getVersion() {
   try {
-    if (/version=(\d+\.?\x?)+/.test(location.href)) {
+    if (/version=[0-9.x]+/.test(location.href)) {
       return location.href.match(/version=([0-9.x]+)/)[1];
     }
   } catch (error) {
-    console.error(error)
-    return "master";
+    console.error(error);
   }
+  return "master";
 }
 
 export function getApiVersion(anchor) {