feat: add debug log for case-insensitive slug fallback
Adds logging when a case-insensitive URL slug fallback is attempted. This helps track when and how often the fallback mechanism is used. Also improves code readability by renaming variable to match camelCase convention.
This commit is contained in:
parent
8941fe3962
commit
7ab62c6a07
1 changed files with 6 additions and 3 deletions
|
|
@ -20,9 +20,12 @@ export default eventHandler(async (event) => {
|
||||||
await KV.get(`link:${key}`, { type: 'json', cacheTtl: linkCacheTtl })
|
await KV.get(`link:${key}`, { type: 'json', cacheTtl: linkCacheTtl })
|
||||||
|
|
||||||
link = await getLink(slug)
|
link = await getLink(slug)
|
||||||
const lowercaseSlug = slug.toLowerCase()
|
|
||||||
if (!caseSensitive && !link && lowercaseSlug !== slug) {
|
// fallback to lowercase slug if caseSensitive is false and the slug is not found
|
||||||
link = await getLink(lowercaseSlug)
|
const lowerCaseSlug = slug.toLowerCase()
|
||||||
|
if (!caseSensitive && !link && lowerCaseSlug !== slug) {
|
||||||
|
console.log('lowerCaseSlug fallback:', `slug:${slug} lowerCaseSlug:${lowerCaseSlug}`)
|
||||||
|
link = await getLink(lowerCaseSlug)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue