-
Notifications
You must be signed in to change notification settings - Fork 436
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1704 from blockscout/hotfix/v1.26.2
Hotfix `v1.26.2`
- Loading branch information
Showing
12 changed files
with
76 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
export default function removeNonSignificantZeroBytes(bytes: Uint8Array) { | ||
return shouldRemoveBytes(bytes) ? bytes.filter((item, index) => index % 32) : bytes; | ||
} | ||
|
||
// check if every 0, 32, 64, etc byte is 0 in the provided array | ||
function shouldRemoveBytes(bytes: Uint8Array) { | ||
let result = true; | ||
|
||
for (let index = 0; index < bytes.length; index += 32) { | ||
const element = bytes[index]; | ||
if (element === 0) { | ||
continue; | ||
} else { | ||
result = false; | ||
break; | ||
} | ||
} | ||
|
||
return result; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export default function bytesToBase64(bytes: Uint8Array) { | ||
let binary = ''; | ||
for (const byte of bytes) { | ||
binary += String.fromCharCode(byte); | ||
} | ||
|
||
const base64String = btoa(binary); | ||
|
||
return base64String; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,8 @@ | ||
import bytesToBase64 from './bytesToBase64'; | ||
import hexToBytes from './hexToBytes'; | ||
|
||
export default function hexToBase64(hex: string) { | ||
const bytes = new Uint8Array(hexToBytes(hex)); | ||
|
||
let binary = ''; | ||
for (const byte of bytes) { | ||
binary += String.fromCharCode(byte); | ||
} | ||
|
||
const base64String = btoa(binary); | ||
|
||
return base64String; | ||
return bytesToBase64(bytes); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+112 KB
ui/blob/__screenshots__/BlobData.pw.tsx_default_image-blob-with-zeroes-bytes-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters