Skip to content

Commit 9a500d2

Browse files
committed
feat: include static content for forms verification
1 parent 0d66533 commit 9a500d2

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/build/content/static.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { existsSync } from 'node:fs'
2-
import { cp, mkdir, rename, rm } from 'node:fs/promises'
2+
import { cp, mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'
33
import { basename, join } from 'node:path'
44

55
import { trace } from '@opentelemetry/api'
@@ -8,6 +8,7 @@ import glob from 'fast-glob'
88

99
import { encodeBlobKey } from '../../shared/blobkey.js'
1010
import { PluginContext } from '../plugin-context.js'
11+
import { verifyNoNetlifyForms } from '../verification.js'
1112

1213
const tracer = wrapTracer(trace.getTracer('Next runtime'))
1314

@@ -25,14 +26,14 @@ export const copyStaticContent = async (ctx: PluginContext): Promise<void> => {
2526
})
2627

2728
try {
29+
await mkdir(destDir, { recursive: true })
2830
await Promise.all(
2931
paths
3032
.filter((path) => !paths.includes(`${path.slice(0, -5)}.json`))
3133
.map(async (path): Promise<void> => {
32-
await cp(join(srcDir, path), join(destDir, await encodeBlobKey(path)), {
33-
recursive: true,
34-
force: true,
35-
})
34+
const html = await readFile(join(srcDir, path), 'utf-8')
35+
verifyNoNetlifyForms(ctx, html)
36+
await writeFile(join(destDir, await encodeBlobKey(path)), html, 'utf-8')
3637
}),
3738
)
3839
} catch (error) {

0 commit comments

Comments
 (0)