Skip to content

Commit 54aa02f

Browse files
committedSep 2, 2024·
fix: handle version conflict with Nuxt Sitemap
Fixes harlan-zw/nuxt-seo#302
1 parent 41b2b84 commit 54aa02f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

Diff for: ‎src/runtime/nitro/composables/getPathRobotConfig.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ export function getPathRobotConfig(e: H3Event, options?: { userAgent?: string, s
1919
}
2020
}
2121
const path = options?.path || e.path
22-
const userAgent = options?.userAgent || getRequestHeader(e, 'User-Agent')
22+
let userAgent = options?.userAgent
Has a conversation. Original line has a conversation.
23+
try {
24+
userAgent = getRequestHeader(e, 'User-Agent')
25+
}
26+
catch {
27+
// version conflict with sitemap module, ignore
28+
}
2329
const nitroApp = useNitroApp()
2430
// 1. robots txt no indexing
2531
const groups = [

0 commit comments

Comments
 (0)
Please sign in to comment.