Skip to content

Commit 49d7880

Browse files
vercel[bot]snomiaoclaude
authored
Fix React Server Components CVE vulnerabilities (#13)
* Fix React Server Components CVE vulnerabilities Updated dependencies to fix Next.js and React CVE vulnerabilities. The fix-react2shell-next tool automatically updated the following packages to their secure versions: - next - react-server-dom-webpack - react-server-dom-parcel - react-server-dom-turbopack All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory. Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com> * format: Apply prettier --fix changes * fix: Add type assertions for sflow chains to resolve TypeScript errors The sflow library wasn't properly inferring types through async map/filter chains, causing TypeScript compilation failures. Added explicit type assertions and type predicates to ensure type safety. Co-Authored-By: Claude Sonnet 4.5 <[email protected]> * format: Apply prettier --fix changes --------- Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com> Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by: snomiao <[email protected]> Co-authored-by: Claude Sonnet 4.5 <[email protected]> Co-authored-by: snomiao <[email protected]>
1 parent 99585d4 commit 49d7880

File tree

3 files changed

+47
-43
lines changed

3 files changed

+47
-43
lines changed

app/page.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export default function Home() {
6767
async function gotFiles(input: File[] | FileList) {
6868
const files = input instanceof FileList ? fileListToArray(input) : input;
6969
if (!files.length) return toast.error("No files provided.");
70-
const readedWorkflowInfos = await sflow(files)
70+
const readedWorkflowInfos = (await sflow(files)
7171
.filter((e) => {
7272
if (e.name.match(/\.(png|flac|webp|mp4|mp3)$/i)) return true;
7373
toast.error("Not Supported format discarded: " + e.name);
@@ -80,8 +80,10 @@ export default function Home() {
8080
return null;
8181
}),
8282
)
83-
.filter()
84-
.toArray();
83+
.filter(
84+
(e): e is Awaited<ReturnType<typeof readWorkflowInfo>> => e !== null,
85+
)
86+
.toArray()) as Awaited<ReturnType<typeof readWorkflowInfo>>[];
8587
setWorkingDir(undefined);
8688
setTasklist(readedWorkflowInfos);
8789
chooseNthFileToEdit(readedWorkflowInfos, 0);
@@ -241,9 +243,9 @@ export default function Home() {
241243
excludeAcceptAllOption: true,
242244
multiple: true,
243245
});
244-
const files = await sf(filesHandles)
246+
const files = (await sf(filesHandles)
245247
.map((e) => e.getFile())
246-
.toArray();
248+
.toArray()) as File[];
247249
return gotFiles(files);
248250
}}
249251
>
@@ -534,13 +536,16 @@ export default function Home() {
534536

535537
async function scanFilelist(workingDir: FileSystemDirectoryHandle) {
536538
const aIter = workingDir.values() as AsyncIterable<FileSystemFileHandle>;
537-
const readed = await sf(aIter)
539+
const readed = (await sf(aIter)
538540
.filter((e) => e.kind === "file")
539541
.filter((e) => e.name.match(/\.(png|flac|webp|mp4|mp3)$/i))
540542
.map(async (e) => await e.getFile())
541-
.map(async (e) => await readWorkflowInfo(e))
542-
.filter((e) => e.workflowJson)
543-
.toArray();
543+
.map(async (e) => await readWorkflowInfo(e as File))
544+
.filter(
545+
(e): e is Awaited<ReturnType<typeof readWorkflowInfo>> =>
546+
!!(e as Awaited<ReturnType<typeof readWorkflowInfo>>).workflowJson,
547+
)
548+
.toArray()) as Awaited<ReturnType<typeof readWorkflowInfo>>[];
544549
setTasklist(readed);
545550
if (snap.editing_index === -1) chooseNthFileToEdit(readed, 0);
546551
return readed;

0 commit comments

Comments
 (0)