Skip to content

Commit f112f29

Browse files
committed
fix: filter out empty tags
1 parent 782a106 commit f112f29

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/run/handlers/cache.cts

+4-4
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
348348
if (requestContext?.didPagesRouterOnDemandRevalidate) {
349349
// encode here to deal with non ASCII characters in the key
350350
const tag = `_N_T_${key === '/index' ? '/' : encodeURI(key)}`
351-
const tags = tag.split(/,|%2c/gi)
351+
const tags = tag.split(/,|%2c/gi).filter(Boolean)
352352

353353
if (tags.length === 0) {
354354
return
@@ -384,9 +384,9 @@ export class NetlifyCacheHandler implements CacheHandlerForMultipleVersions {
384384
private async doRevalidateTag(tagOrTags: string | string[], ...args: any) {
385385
getLogger().withFields({ tagOrTags, args }).debug('NetlifyCacheHandler.revalidateTag')
386386

387-
const tags = (Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags]).flatMap((tag) =>
388-
tag.split(/,|%2c/gi),
389-
)
387+
const tags = (Array.isArray(tagOrTags) ? tagOrTags : [tagOrTags])
388+
.flatMap((tag) => tag.split(/,|%2c/gi))
389+
.filter(Boolean)
390390

391391
if (tags.length === 0) {
392392
return

0 commit comments

Comments
 (0)