validation of string not URL
This commit is contained in:
@@ -34,11 +34,12 @@ export const ImportDialog = ({
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const base64String = QRCodeURL.split("e/#")[1]
|
const base64String = QRCodeURL.split("e/#")[1]
|
||||||
?.replace(/-/g, "+")
|
const paddedString = base64String
|
||||||
.replace(/_/g, "/")
|
?.padEnd(base64String.length + ((4 - (base64String.length % 4)) % 4), "=")
|
||||||
.padEnd(QRCodeURL.length + ((4 - (QRCodeURL.length % 4)) % 4), "=");
|
.replace(/-/g, "+")
|
||||||
|
.replace(/_/g, "/");
|
||||||
try {
|
try {
|
||||||
setChannelSet(Protobuf.ChannelSet.fromBinary(toByteArray(base64String)));
|
setChannelSet(Protobuf.ChannelSet.fromBinary(toByteArray(paddedString)));
|
||||||
setValidURL(true);
|
setValidURL(true);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
setValidURL(false);
|
setValidURL(false);
|
||||||
|
|||||||
Reference in New Issue
Block a user