OpenLayers OpenLayers

Ticket #384 (closed feature: fixed)

Opened 2 years ago

Last modified 1 year ago

allow for comparison of URLs based on equivalence

Reported by: tschaub Assigned to: crschmidt
Priority: minor Milestone: 2.3 Release
Component: general Version:
Keywords: Cc:
State:

Description

There are a number of places where URLs are compared strictly (as strings) - in the tests mainly, but also in the new check for image tile sources.

These comparisons fail with relative URLs, if case is different, if search string parameters are not in the same order, and if port 80 is explicit (on Firefox).

I'll follow this with a function that could be added to Util.js to allow for more flexible URL comparison. Specifically it returns true for the following calls

// allows relative paths - assuming we're in the examples directory
OpenLayers.Util.isEquivalentUrl('foo', '../examples/foo');

// by default, ignores case - this can be changed with options
OpenLayers.Util.isEquivalentUrl('foo?one=1', 'foo?ONE=1');

// ignores search string parameter order
OpenLayers.Util.isEquivalentUrl('foo?one=1&two=2', 'foo?two=2&one=1');

// ignores port 80 by default
OpenLayers.Util.isEquivalentUrl('http://foo.com:80', 'http://foo.com');

// ignores hash by default
OpenLayers.Util.isEquivalentUrl('foo#ignored', 'foo');

Attachments

util_addition.js (2.2 kB) - added by tschaub on 10/30/06 17:55:52.
isEquivalentUrl function
equivalent_url.patch (2.6 kB) - added by euzuro on 12/22/06 12:00:44.
Patch version of js file
equivalent_url.2.patch (6.0 kB) - added by euzuro on 12/22/06 13:56:37.
slightly modified of original patch with tests and code actually applied to Tile.Image

Change History

10/30/06 17:55:52 changed by tschaub

  • attachment util_addition.js added.

isEquivalentUrl function

10/30/06 17:57:45 changed by tschaub

  • keywords set to review.

This function requires the patch for #378. Please review.

11/18/06 10:11:23 changed by crschmidt

Hm. I'm concerned about the performance implications here, so I'll try and do some testing to reassure myself as soon as possible. I do think we need to get some change which has something like this affect on the checkImgURL code, since breaking relatively links is a bug.

12/06/06 16:37:53 changed by crschmidt

  • owner set to crschmidt.
  • status changed from new to assigned.

12/22/06 11:46:42 changed by euzuro

needs to be pulled into Tile/Image.js

12/22/06 12:00:44 changed by euzuro

  • attachment equivalent_url.patch added.

Patch version of js file

12/22/06 13:56:37 changed by euzuro

  • attachment equivalent_url.2.patch added.

slightly modified of original patch with tests and code actually applied to Tile.Image

12/22/06 14:04:11 changed by crschmidt

  • status changed from assigned to closed.
  • resolution set to fixed.

Applied in r2093.

07/05/07 17:05:22 changed by euzuro

  • keywords deleted.