Ticket #5732 (closed defect: fixed)

Opened 7 months ago

Last modified 7 months ago

baseUrl not computed when url has a parameter

Reported by: guest Owned by: jburke
Priority: normal Milestone: 1.1
Component: Core Version: 1.0
Severity: normal Keywords:
Cc: ctheiss@…

Description

When using a server framework it is often the case that url rewriting becomes an issue. For example, if you don't know your application context and are using JSP, you might want to wrap your dojo call in a c:url:

<script type='text/javascript' src='<c:url value="/javascript/dojo/dojo.js"/>'></script>

However, if cookies are turned off, a session identified might be appended to the url:

<script type='text/javascript' src='/myapp/javascript/dojo/dojo.js;jsessionid=23482357984578578542875'></script>

This added parameter breaks the regex in hostenv_browser.js so that baseUrl is not computed:

  var rePkg = /dojo(.xd)?.js([?.]|$)/i;

The regex should probably be changed to (notice the extra semi-colon):

  var rePkg = /dojo(.xd)?.js([;?.]|$)/i;

to handle this case.

Change History

Changed 7 months ago by peller

  • owner changed from anonymous to jburke
  • milestone deleted

is this a valid url syntax?

Changed 7 months ago by guest

It is valid syntax: it is a path parameter rather than a query parameter. See the last paragraph of 3.3: http://www.rfc.net/rfc3986.html#p22

Changed 7 months ago by guest

Please add me as cc: ctheiss@…

Thanks!

Changed 7 months ago by jburke

  • cc ctheiss@… added
  • milestone set to 1.1

I'll see about getting this in for 1.1. Note that you can always force the baseUrl via djConfig.baseUrl, so that is a workaround.

Changed 7 months ago by guest

Setting djConfig.baseUrl, while an acceptable workaround, has two issues which prevent it from being a "good" fix:

  1. You can hard-code it, but now your application is no longer context-agnostic
  2. You can run a regular expression against window.location.href, but it would be almost exactly the same code as in hostenv_browser.js (except with the extra semi-colon).

Changed 7 months ago by jburke

  • status changed from new to closed
  • resolution set to fixed

(In [12272]) Fixes #5732. Allow other non-word character terminators like ; for dojo url.

Note: See TracTickets for help on using tickets.