From 83203a834e421924a83ad994269e50c65246bdbe Mon Sep 17 00:00:00 2001 From: Gerhard Steenkamp Date: Tue, 26 Mar 2024 22:27:11 +0200 Subject: [PATCH] fix quick fix --- .../oSnap/components/Input/MethodParameter.vue | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/plugins/oSnap/components/Input/MethodParameter.vue b/src/plugins/oSnap/components/Input/MethodParameter.vue index b48f0a67..4f4893ff 100644 --- a/src/plugins/oSnap/components/Input/MethodParameter.vue +++ b/src/plugins/oSnap/components/Input/MethodParameter.vue @@ -52,9 +52,8 @@ const errorMessageForDisplay = computed(() => { } }); -// only suggest padding with zeros if too short but still valid bytes (even characters & starts with "0x") const allowQuickFixForBytes32 = computed(() => { - if (errorMessageForDisplay?.value?.includes('short')) { + if (!errorMessageForDisplay?.value?.includes('long')) { return true; } return false; @@ -97,13 +96,15 @@ function validateBytes32Input(value: string) { try { const data = value?.slice(2) || ''; - if (!isBytesLike(value)) { - throw new Error('Invalid bytes32'); - } if (data.length < 64) { validationErrorMessage.value = 'Value too short'; throw new Error('Less than 32 bytes'); } + + if (!isBytesLike(value)) { + throw new Error('Invalid bytes32'); + } + if (data.length > 64) { validationErrorMessage.value = 'Value too long'; throw new Error('More than 32 bytes');