Ticket #1305 (closed bug: duplicate)
Multi-file include breaks if there are query parameters specified
| Reported by: | openlayers | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | 2.6 Release |
| Component: | general | Version: | 2.5 |
| Keywords: | Cc: | beau@… | |
| State: | Review |
Description
I'm using OpenLayers with Drupal, and included JS flies sometimes get query parameters like ?m appended to the end.
In OpenLayers.js I added a small test to _getScriptLocation to strip these off before comparing.
--- OpenLayers-2.5/lib/OpenLayers.js Tue Oct 9 13:45:37 2007
+++ ../lib/OpenLayers.js Mon Jan 28 01:59:02 2008
@@ -42,7 +42,14 @@
for (var i = 0; i < scripts.length; i++) {
var src = scripts[i].getAttribute('src');
if (src) {
- var index = src.lastIndexOf(scriptName);
+ // remove any query parameters
+ var index = src.lastIndexOf("?");
+
+ if (index > -1) {
+ src = src.slice(0, index);
+ }
+
+ index = src.lastIndexOf(scriptName);
// is it found, at the end of the URL?
if ((index > -1) && (index + scriptName.length == src.length)) {
scriptLocation = src.slice(0, -scriptName.length);
Change History
Note: See
TracTickets for help on using
tickets.
