Skip to content
This repository was archived by the owner on Jun 22, 2024. It is now read-only.

Commit acf7373

Browse files
authored
fix(compiler): when useStorage returns a Uint8Array, decode it to text (fixes #33) (#34)
* fix(compiler): when useStorage returns a `Uint8Array`, decode it to text (fixes #33) * chore: lint
1 parent 8f8ffc5 commit acf7373

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/runtime/server/nitro/useCompiler.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,18 @@ export async function useCompiler(
1111
verbose = false,
1212
) {
1313
const vueEmailOptions = useRuntimeConfig().public.vueEmail as ModuleOptions
14-
const source = await useStorage(storageKey).getItem(filename)
14+
let source = await useStorage(storageKey).getItem(filename)
15+
if (source instanceof Uint8Array)
16+
source = new TextDecoder().decode(source)
1517
const keys = await useStorage(storageKey).getKeys()
1618
const components: {
1719
name: string
1820
source: string
1921
}[] = []
2022
for (const key of keys) {
21-
const value = await useStorage(storageKey).getItem(key)
23+
let value = await useStorage(storageKey).getItem(key)
24+
if (value instanceof Uint8Array)
25+
value = new TextDecoder().decode(value)
2226

2327
if (value && key.endsWith('.vue')) {
2428
components.push({

0 commit comments

Comments
 (0)