@akinon/next 1.92.0-rc.34 → 1.92.0-rc.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 1.92.0-rc.35
4
+
5
+ ### Minor Changes
6
+
7
+ - 89ce46fc: ZERO-3493: return 404 status code for pz-not-found pages
8
+
3
9
  ## 1.92.0-rc.34
4
10
 
5
11
  ### Minor Changes
@@ -302,19 +302,6 @@ const withPzDefault =
302
302
  )}`;
303
303
  }
304
304
 
305
- if (
306
- !req.middlewareParams.found &&
307
- Settings.customNotFoundEnabled
308
- ) {
309
- const pathname = url.pathname
310
- .replace(/\/+$/, '')
311
- .split('/');
312
- url.pathname = url.pathname.replace(
313
- pathname.pop(),
314
- 'pz-not-found'
315
- );
316
- }
317
-
318
305
  Settings.rewrites.forEach((rewrite) => {
319
306
  url.pathname = url.pathname.replace(
320
307
  rewrite.source,
@@ -352,6 +339,24 @@ const withPzDefault =
352
339
  middlewareResult = NextResponse.rewrite(url);
353
340
  }
354
341
 
342
+ if (
343
+ !req.middlewareParams.found &&
344
+ Settings.customNotFoundEnabled
345
+ ) {
346
+ const pathSegments = url.pathname
347
+ .replace(/\/+$/, '')
348
+ .split('/');
349
+ if (pathSegments.length >= 3) {
350
+ url.pathname = `/${pathSegments[1]}/${pathSegments[2]}/pz-not-found`;
351
+ } else {
352
+ url.pathname = '/pz-not-found';
353
+ }
354
+
355
+ middlewareResult = NextResponse.rewrite(url, {
356
+ status: 404
357
+ });
358
+ }
359
+
355
360
  const { localeUrlStrategy } =
356
361
  Settings.localization;
357
362
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "1.92.0-rc.34",
4
+ "version": "1.92.0-rc.35",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -34,7 +34,7 @@
34
34
  "set-cookie-parser": "2.6.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@akinon/eslint-plugin-projectzero": "1.92.0-rc.34",
37
+ "@akinon/eslint-plugin-projectzero": "1.92.0-rc.35",
38
38
  "@babel/core": "7.26.10",
39
39
  "@babel/preset-env": "7.26.9",
40
40
  "@babel/preset-typescript": "7.27.0",