-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: xml parsing exception caused by ascii control character
- Loading branch information
Showing
3 changed files
with
13 additions
and
18 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 |
---|---|---|
@@ -1,25 +1,18 @@ | ||
import { baseFetch } from './fetch' | ||
import { consoleWarn } from './utils' | ||
import type { BaseFetchOptions } from './fetch' | ||
|
||
const worker = self as unknown as Worker | ||
|
||
worker.onmessage = async event => { | ||
const options = event.data as BaseFetchOptions & { rawUrl: string } | ||
|
||
const result = await baseFetch(options) | ||
|
||
const stream = new ReadableStream<any>({ | ||
pull(controller) { | ||
controller.enqueue(result) | ||
controller.close() | ||
}, | ||
}) | ||
|
||
const url = options.rawUrl || options.url | ||
|
||
if (stream) { | ||
worker.postMessage({ url, stream }, [stream]) | ||
} else { | ||
try { | ||
const result = await baseFetch(options) | ||
worker.postMessage({ url, result }) | ||
} catch (error) { | ||
consoleWarn(error) | ||
worker.postMessage({ url }) | ||
} | ||
} |
a48cb89
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
modern-screenshot – ./
modern-screenshot.vercel.app
modern-screenshot-git-main-qq15725.vercel.app
modern-screenshot-qq15725.vercel.app