mirror of
https://github.com/meshtastic/web.git
synced 2026-01-26 08:19:13 -05:00
Merge pull request #140 from pdxlocations/url-validation
Fix URL Validation
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "meshtastic-web",
|
||||
"version": "2.2.12-0",
|
||||
"version": "2.2.12-1",
|
||||
"type": "module",
|
||||
"description": "Meshtastic web client",
|
||||
"license": "GPL-3.0-only",
|
||||
|
||||
@@ -34,11 +34,12 @@ export const ImportDialog = ({
|
||||
|
||||
useEffect(() => {
|
||||
const base64String = QRCodeURL.split("e/#")[1]
|
||||
?.replace(/-/g, "+")
|
||||
.replace(/_/g, "/")
|
||||
.padEnd(QRCodeURL.length + ((4 - (QRCodeURL.length % 4)) % 4), "=");
|
||||
const paddedString = base64String
|
||||
?.padEnd(base64String.length + ((4 - (base64String.length % 4)) % 4), "=")
|
||||
.replace(/-/g, "+")
|
||||
.replace(/_/g, "/");
|
||||
try {
|
||||
setChannelSet(Protobuf.ChannelSet.fromBinary(toByteArray(base64String)));
|
||||
setChannelSet(Protobuf.ChannelSet.fromBinary(toByteArray(paddedString)));
|
||||
setValidURL(true);
|
||||
} catch (error) {
|
||||
setValidURL(false);
|
||||
|
||||
Reference in New Issue
Block a user