fix script tags with ? after the file name
Reported by Brian Moschel | March 17th, 2010 @ 08:24 PM
If you include a script tag like:
Env will try to request "steal.js?steal[app]=callcenter&include[env]=development". The browsers will request "steal.js". Env should be made to mirror this behavior. Thatcher said the best place for this is in Envjs.uri, which should detect if its a file or network protocol. There is currently logic that fixes this problem in src/platform/core/html.js, line 94, but it is commented out: filename = Envjs.uri(script.src.match(/([^\?#]*)/)[1], base );Comments and changes to this ticket
-
nickg March 18th, 2010 @ 04:52 AM
Hi Brian,
I'll work on this for you since I'm just reworking Envjs.uri anyways. Right now it doesn't handle relative paths very well nor javascript: based urls. So I'll your issue to the pile. Might want to follow ticket #115 as well.
The script tag you posted got mangled by lighthouse. Can you repost the src? (I'm sure I can figure it out, but...).
--nickg
-
Brian Moschel March 18th, 2010 @ 05:06 AM
Thanks Nick,
Here is that script tag:
<script type='text/javascript' src='steal.js?steal[app]=myapp&steal[env]=development'></script>
-
nickg March 18th, 2010 @ 05:40 AM
hi again,
and in this case you are loading the original document as a file, not http? (just checking)
-
Brian Moschel March 18th, 2010 @ 06:17 AM
Actually I'm not sure. I'm invoking Envjs with a relative URL like this:
Envjs('callcenter/funcunit.html')
-
Thatcher March 18th, 2010 @ 06:59 AM
This would imply use of the file:// protocol. Are you wanting to load from
a server via http? I use envjs for both but we do have general issues with
the query string messing stuff up when accessing local files ie java will
throw an exception if you try to openwindow.location = 'file:///tmp/foo.html?bar';
So even if we strip them off before accessing the file, the
window.location.query would now have the expected value. Just something to
keep in mind as we try to iron out the Envjs.uri issues. -
nickg March 18th, 2010 @ 06:21 PM
hola,
You can pull this in, and you should be able to move forward, however it's not the final patch.
http://github.com/client9/env-js/commit/3fbc94d726681ca9d843ccb5972...
I'll need chris's help on making the final patch.
--nickg
-
nickg March 18th, 2010 @ 06:41 PM
of course the one thing I didnt unit-test had a bug.
I'm not really sure how to tell you the best way to grab my copy of
src/platform/rhino/xhr.js
.Cut-n-Paste with
http://github.com/client9/env-js/blob/master/src/platform/rhino/xhr.jsYou can apply the following patches
http://github.com/client9/env-js/commit/3fbc94d726681ca9d843ccb5972...
http://github.com/client9/env-js/commit/560757564062f8bc5468472d95e... -
nickg March 24th, 2010 @ 06:43 PM
- Assigned user changed from Thatcher to nickg
Try pulling down the latest changes and see if your problem is resolved (or not).
thanks!
--nickg
-
nickg March 30th, 2010 @ 03:03 AM
- State changed from new to resolved
resolving... no one has complained after the fix went in.
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
a javascript browser environment