Skip to content

Commit 18b652f

Browse files
authored
fix: skip validation on redirect HTML (#614)
1 parent 37f9e57 commit 18b652f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,5 @@ export const DEFAULTS: Required<Omit<ModuleOptions, 'logLevel'>> & { logLevel?:
5050
hookable: false,
5151
ignore: [/\.(xml|rss|json)$/],
5252
}
53+
54+
export const NuxtRedirectHtmlRegex = /<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=([^"]+)"><\/head><\/html>/

src/module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { isWindows } from 'std-env'
55
import { genArrayFromRaw, genObjectFromRawEntries } from 'knitwork'
66

77
import { createResolver, defineNuxtModule, isNuxt2, logger, resolvePath } from '@nuxt/kit'
8-
import { DEFAULTS } from './config'
8+
import { DEFAULTS, NuxtRedirectHtmlRegex } from './config'
99
import type { ModuleOptions } from './config'
1010

1111
export type { ModuleOptions }
@@ -88,6 +88,9 @@ export default defineNuxtModule<ModuleOptions>({
8888
if (!route.contents || !route.fileName?.endsWith('.html')) {
8989
return
9090
}
91+
if (route.contents.match(NuxtRedirectHtmlRegex)) {
92+
return
93+
}
9194
checkHTML(route.route, route.contents)
9295
})
9396
})

0 commit comments

Comments
 (0)