Skip to content

Commit

Permalink
fix: don't fallthrough blob data case
Browse files Browse the repository at this point in the history
  • Loading branch information
CodyJasonBennett committed Oct 21, 2023
1 parent b917344 commit b93242e
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/fiber/src/native/polyfills.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ export function polyfills() {

const uri = fs.cacheDirectory + uuidv4() + `.${type}`
await fs.writeAsStringAsync(uri, data, { encoding: fs.EncodingType.Base64 })

return uri
}
}

Expand Down Expand Up @@ -124,15 +126,6 @@ export function polyfills() {

getAsset(url)
.then(async (uri) => {
// Create safe URI for JSI
if (uri.startsWith('data:')) {
const [header, data] = uri.split(',')
const [, type] = header.split('/')

uri = fs.cacheDirectory + uuidv4() + `.${type}`
await fs.writeAsStringAsync(uri, data, { encoding: fs.EncodingType.Base64 })
}

const { width, height } = await new Promise<{ width: number; height: number }>((res, rej) =>
Image.getSize(uri, (width, height) => res({ width, height }), rej),
)
Expand Down

0 comments on commit b93242e

Please sign in to comment.