urfreespace commented on code in PR #439:
URL: https://github.com/apache/pulsar-site/pull/439#discussion_r1119640185


##########
src/utils/index.js:
##########
@@ -54,10 +54,14 @@ export function setVersion(version) {
 }
 
 export function getVersion() {
-  if (/version=(\d+\.?\x?)+/.test(location.href)) {
-    return location.href.match(/version=(\d+\.?\x?)+/)[0];
+  try {
+    if (/version=(\d+\.?\x?)+/.test(location.href)) {
+      return location.href.match(/version=((\d+\.?\x?)+)/)[1];
+    }

Review Comment:
   this function is used to get version information from the URL 
`location.href`, for example: 
`https://pulsar.apache.org/admin-rest-api/?version=2.11.0&apiversion=v2#operation/getList`,
 no input param, will auto get URL from `location.href`, and return the version 
numbers, is `2.11.0` for this example



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to