Skip to content

Commit ae78af0

Browse files
committed
fix blob downloading
1 parent 4800753 commit ae78af0

File tree

3 files changed

+36
-4
lines changed

3 files changed

+36
-4
lines changed

components/TheHeader.vue

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ const isActive = (link) => {
5050
</NuxtLink>
5151
</Flex>
5252

53-
<Icon name="empty" :class="$style.empty_icon" />
53+
<Flex align="center" gap="8" :class="$style.command_button">
54+
<Icon name="search" size="16" color="secondary" />
55+
</Flex>
5456
</Flex>
5557
</Flex>
5658
</template>
@@ -121,6 +123,26 @@ const isActive = (link) => {
121123
}
122124
}
123125
126+
.command_button {
127+
height: 28px;
128+
129+
border-radius: 6px;
130+
background: var(--op-5);
131+
cursor: pointer;
132+
133+
padding: 0 8px;
134+
135+
transition: all 0.2s ease;
136+
137+
&:hover {
138+
background: var(--op-8);
139+
}
140+
141+
&:active {
142+
background: var(--op-10);
143+
}
144+
}
145+
124146
@media (max-width: 600px) {
125147
.wrapper {
126148
height: initial;

components/modals/BlobModal.vue

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Modal from "@/components/ui/Modal.vue"
44
import Button from "@/components/ui/Button.vue"
55
66
/** Services */
7-
import { formatBytes, getNamespaceID } from "@/services/utils"
7+
import { formatBytes, getNamespaceID, strToHex } from "@/services/utils"
88
99
/** API */
1010
import { fetchNamespaceByMetadata } from "@/services/api/namespace"
@@ -65,8 +65,7 @@ watch(
6565
6666
const handleDownload = () => {
6767
const byteArray = new Uint8Array(
68-
decodedData.value
69-
.replaceAll(" ", "")
68+
strToHex(atob(blob.value.data))
7069
.match(/.{2}/g)
7170
.map((e) => parseInt(e, 16)),
7271
)

services/utils/general.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,14 @@ export const getNamespaceID = (target) => {
1818

1919
return s
2020
}
21+
22+
export const strToHex = (str) => {
23+
let hex = ""
24+
for (let i = 0; i < str.length; i++) {
25+
const charCode = str.charCodeAt(i)
26+
const hexValue = charCode.toString(16)
27+
28+
hex += hexValue.padStart(2, "0")
29+
}
30+
return hex
31+
}

0 commit comments

Comments
 (0)