@anthusai/papyrus 5.121.0-next.1 → 5.121.0

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.
@@ -124,6 +124,11 @@ function queryStringOf(request) {
124
124
  return parts.length === 0 ? "" : "?" + parts.join("&");
125
125
  }
126
126
 
127
+ // A redirect keeps the request's query string (a path on this site only: an absolute target is the rule's own address).
128
+ function withQuery(target, request) {
129
+ return target.charAt(0) === "/" && target.indexOf("?") === -1 ? target + queryStringOf(request) : target;
130
+ }
131
+
127
132
  function wwwRedirectResponse(request) {
128
133
  const header = request.headers && request.headers.host;
129
134
  const host = header && header.value ? header.value.toLowerCase() : "";
@@ -150,7 +155,7 @@ async function handler(event) {
150
155
  return {
151
156
  statusCode: 301,
152
157
  statusDescription: "Moved Permanently",
153
- headers: { location: { value: redirectTarget } },
158
+ headers: { location: { value: withQuery(redirectTarget, request) } },
154
159
  };
155
160
  }
156
161
  const patternRedirect = lookUpPatternRedirect(request.uri);
@@ -158,7 +163,7 @@ async function handler(event) {
158
163
  return {
159
164
  statusCode: patternRedirect.status,
160
165
  statusDescription: "Moved",
161
- headers: { location: { value: patternRedirect.target } },
166
+ headers: { location: { value: withQuery(patternRedirect.target, request) } },
162
167
  };
163
168
  }
164
169
  request.uri = rewriteToIndexDocument(request.uri);
package/package.json CHANGED
@@ -640,7 +640,7 @@
640
640
  "optional": true
641
641
  }
642
642
  },
643
- "version": "5.121.0-next.1",
643
+ "version": "5.121.0",
644
644
  "dependencies": {
645
645
  "@aws-amplify/adapter-nextjs": "^1.7.3",
646
646
  "@aws-crypto/sha256-js": "5.2.0",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.121.0-next.1",
2
+ "version": "5.121.0",
3
3
  "routes": [
4
4
  {
5
5
  "file": "app/%5F_preview/[[...path]]/route.ts",