Really fix __webpack_public_path__ for 1.11 (#11961)

Trailing slash is actually significant, fixed that and i've now tested
it as well.

Ref: https://github.com/go-gitea/gitea/issues/11839#issuecomment-646203505
This commit is contained in:
silverwind 2020-06-18 22:40:07 +02:00 committed by GitHub
parent 7937f1463a
commit ce51c2bdf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@
const { StaticUrlPrefix } = window.config; const { StaticUrlPrefix } = window.config;
if (StaticUrlPrefix) { if (StaticUrlPrefix) {
__webpack_public_path__ = `${StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`}js`; __webpack_public_path__ = `${StaticUrlPrefix.endsWith('/') ? StaticUrlPrefix : `${StaticUrlPrefix}/`}js/`;
} else if (document.currentScript && document.currentScript.src) { } else if (document.currentScript && document.currentScript.src) {
const url = new URL(document.currentScript.src); const url = new URL(document.currentScript.src);
__webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`; __webpack_public_path__ = `${url.pathname.replace(/\/[^/]*$/, '')}/`;