Skip to content

Commit b4c946b

Browse files
Merge pull request #17 from puzzle-js/MW-5350
update - source attribute is excluded from query string, location.rep…
2 parents ee094a5 + 73b63b3 commit b4c946b

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@puzzle-js/client-lib",
33
"main": "dist/index.js",
4-
"version": "1.3.5",
4+
"version": "1.4.0",
55
"author": "<[email protected]>",
66
"license": "MIT",
77
"repository": {

src/core.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export class Core extends Module {
161161
if (res['$headers']) {
162162
const locationRedirect = res['$headers'].location || res['$headers'].Location;
163163
if (locationRedirect) {
164-
return location.href = res['$headers'].location;
164+
return location.replace(res['$headers'].location);
165165
}
166166
}
167167

@@ -186,7 +186,7 @@ export class Core extends Module {
186186
private static prepareQueryString(fragmentAttributes: Record<string, string>) {
187187
const attributes = Object.assign(window.location.search.slice(1).split('&').reduce((dict: { [name: string]: string }, i) => {
188188
const [key, value] = i.split('=');
189-
if (typeof value !== "undefined") {
189+
if (typeof value !== "undefined" && key !== "source") {
190190
dict[key] = value;
191191
}
192192
return dict;
@@ -200,7 +200,7 @@ export class Core extends Module {
200200
elm.outerHTML = html;
201201
return;
202202
}
203-
203+
204204
elm.innerHTML = html;
205205
Array.from(elm.querySelectorAll("script")).forEach((oldScript: any) => {
206206
const newScript = document.createElement("script");

0 commit comments

Comments
 (0)