From 07a0658fee962a0446fd0cacc9d266fc67747033 Mon Sep 17 00:00:00 2001 From: Natsumi Date: Sun, 30 May 2021 22:37:38 +1200 Subject: [PATCH] Fix location URL parse --- html/src/app.js | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/html/src/app.js b/html/src/app.js index f8cc56b1..dd86880d 100644 --- a/html/src/app.js +++ b/html/src/app.js @@ -7654,7 +7654,14 @@ speechSynthesis.getVoices(); var testUrl = instance.inputValue.substring(0, 15); if (testUrl === 'https://vrchat.') { var worldInstance = this.parseLocationUrl(instance.inputValue); - this.showWorldDialog(worldInstance); + if (worldInstance) { + this.showWorldDialog(worldInstance); + } else { + this.$message({ + message: 'Invalid URL', + type: 'error' + }); + } } else { this.showWorldDialog(instance.inputValue); } @@ -11929,11 +11936,16 @@ speechSynthesis.getVoices(); // Parse location URL - $app.methods.parseLocationUrl = function (url) { + $app.methods.parseLocationUrl = function (location) { + var url = new URL(location); var urlParams = new URLSearchParams(url.search); var worldId = urlParams.get('worldId'); var instanceId = urlParams.get('instanceId'); - return `${worldId}:${instanceId}`; + if (instanceId) { + return `${worldId}:${instanceId}`; + } else if (worldId) { + return worldId; + } }; // userDialog Favorite Worlds