puppeteer/fix-location.js
release-please[bot] a373660554 deploy: b2c69fe5bd
2024-02-05 09:31:22 +00:00

11 lines
325 B
JavaScript

/**
* @license
* Copyright 2024 Google Inc.
* SPDX-License-Identifier: Apache-2.0
*/
const url = new URL(window.location.href);
if (url.pathname.endsWith('/') && url.pathname !== '/') {
url.pathname = url.pathname.substring(0, url.pathname.length - 1);
window.history.replaceState(null, undefined, url.toString());
}