Skip to content

Commit

Permalink
change cesiumScriptRegex value
Browse files Browse the repository at this point in the history
fixes Issue CesiumGS#8902
  • Loading branch information
xiaobaogeit committed Jun 5, 2020
1 parent 1ae6836 commit aa8b30a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu
- [Edvinas Pranka](https://github.com/epranka)
- [James Bromwell](https://github.com/thw0rted)
- [Brandon Nguyen](https://github.com/bn-dignitas)
- [Wang Bao](https://github.com/xiaobaogeit)
2 changes: 1 addition & 1 deletion Source/Core/buildModuleUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Resource from "./Resource.js";

/*global CESIUM_BASE_URL*/

var cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js$/;
var cesiumScriptRegex = /((?:.*\/)|^)Cesium\.js(?:\W|$)/;
function getBaseUrlFromCesiumScript() {
var scripts = document.getElementsByTagName("script");
for (var i = 0, len = scripts.length; i < len; ++i) {
Expand Down
5 changes: 5 additions & 0 deletions Specs/Core/buildModuleUrlSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ describe("Core/buildModuleUrl", function () {
var r = buildModuleUrl._cesiumScriptRegex;

expect(r.exec("Cesium.js")[1]).toEqual("");
expect(r.exec("Cesium.js?v=1.7")[1]).toEqual("");
expect(r.exec("assets/foo/Cesium.js")[1]).toEqual("assets/foo/");
expect(r.exec("assets/foo/Cesium.js?v=1.7")[1]).toEqual("assets/foo/");
expect(
r.exec("http://example.invalid/Cesium/assets/foo/Cesium.js")[1]
).toEqual("http://example.invalid/Cesium/assets/foo/");
expect(
r.exec("http://example.invalid/Cesium/assets/foo/Cesium.js?v=1.7")[1]
).toEqual("http://example.invalid/Cesium/assets/foo/");

expect(r.exec("assets/foo/bar.cesium.js")).toBeNull();
});
Expand Down

0 comments on commit aa8b30a

Please sign in to comment.