Ticket #1263 (closed feature: fixed)

Opened 5 years ago

Last modified 5 years ago

_getScriptLocation cannot handle query string

Reported by: openlayers Owned by:
Priority: minor Milestone: 2.6 Release
Component: general Version: 2.5
Keywords: Cc: john.pulles@…
State: Complete

Description

When adding a javascript file using the drupal drupal_add_js function, the src parameter may get a query string to prevent caching. The _getScriptLocation function cannot handle this, because it assumes that the scriptName is at the end of the string. In case of a query string, it should use the position of the ? as the end. A patch is attached.

For example:

<script type="text/javascript" src="/drupal/sites/all/modules/mapclient/OpenLayers-2.5/lib/OpenLayers.js?f"></script>

This would make the OpenLayers code more robust, and would facilitate integration with a CMS like Drupal.

Attachments

OpenLayers.js.patch Download (1.0 KB) - added by openlayers 5 years ago.
OpenLayers-update-1.js.patch Download (1.0 KB) - added by openlayers 5 years ago.
1263-r5920-A0.patch Download (1.0 KB) - added by ahocevar 5 years ago.
same as the above patch, but applies to the OpenLayers directory root.

Change History

Changed 5 years ago by openlayers

Changed 5 years ago by ahocevar

John, nice catch. I am in favour of this patch. One small remark: If clauses in OpenLayers should never be used without curly braces (line 48/49).

It would be great to have a test for this, but I know that there is no test file for OpenLayers.js yet. I created #1267 to track this.

Changed 5 years ago by ahocevar

  • state changed from Review to Needs More Work

Changed 5 years ago by openlayers

Changed 5 years ago by openlayers

  • state changed from Needs More Work to Review
  • milestone set to 2.6 Release

Updated the patch per ahocevar's comment and changed milestone to reflect the one that the bug I created was set to.

Changed 5 years ago by ahocevar

same as the above patch, but applies to the OpenLayers directory root.

Changed 5 years ago by ahocevar

Patch looks good. I will commit as soon as someone reviews #1267 and tells me that the test over there is valid.

Changed 5 years ago by ahocevar

  • keywords script location removed
  • status changed from new to closed
  • state changed from Review to Complete
  • resolution set to fixed

(In [5921]) "_getScriptLocation cannot handle query string". Patch originally by john.pulles@…, improved by beau@…. Thanks! r=crschmidt,me (closes #1263)

Note: See TracTickets for help on using tickets.