-
Notifications
You must be signed in to change notification settings - Fork 2k
Update common.js #744
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update common.js #744
Conversation
Bugfix: outgoing url is wrong when the source url is 'http://a.b.c/d/??e/a.js,f/b.js,g/c.js?t=123456' (a combo url).
When you merged the changed codes and update to a new version, please leave a message! Thank you! |
@@ -155,7 +155,12 @@ common.urlJoin = function() { | |||
|
|||
// Only join the query string if it exists so we don't have trailing a '?' | |||
// on every request | |||
lastSegs[1] && retSegs.push(lastSegs[1]); | |||
// Maybe there are many '?' in the url, | |||
// such as 'http://a.b.c/d/??e/a.js,f/b.js,g/c.js?t=123456'(a combo request url), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this even a valid url?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a online url 'http://g.tbcdn.cn/??kissy/k/1.4.0/seed-min.js,kissy/k/1.4.0/base-min.js,kissy/k/1.4.0/json-min.js,kissy/k/1.4.0/dom/base-min.js,kissy/k/1.4.0/event/base-min.js,kissy/k/1.4.0/event/custom-min.js,kissy/k/1.4.0/event/dom/base-min.js,kissy/k/1.4.0/event/dom/focusin-min.js' on the Alibaba CDNs. You can take it
for test.
@koolc is there a failing test this is compensating for? To be fair this logic is still not 100% correct but this change doesn't look like the right fix. |
@jcrugzz @samccone This is a combo url(This is a technical measures that multiple requests will be merged into one in order to reduce the number of requests), and '??' is a combo tag. I mainly think of this case, so maybe the changed logic is still not 100% correct, hope you can revise it. |
@koolc could you write a test case using this type of URL? I will look closer at the logic |
A bin test file content:
|
I think the test case(exists many '?') below in the
I have sent a pull request , you can see my changes. |
// so to use `forEach`. | ||
lastSegs.forEach(function (slice) { | ||
retSegs.push(slice); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this below is better.
retSegs.push.apply(retSegs, lastSegs);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea that change would be ideal, after that, this LGTM.
Excuse me, but I want to know when to support the change? My component will recently publish and it requires the 'http-proxy' module. So I expect the fresh version very much. Thank you! |
@koolc sorry for the late reply, once that change you already suggested is done, this should be merged. If you have anymore URL test cases for this function, it would be awesome to get more tests around this. |
Sorry, I didn't fully understand what you mean, but the previous test case modified by me has been provided at #746 last week, and I'm sorry I have the only one application scene to use the function, so it's difficult for me to get more tests around this. Though, even if no more test cases, I'm sure that the function must be wrong. So, at least so far, I think it's the most important to correct it and the test cases can be accumulated slowly. Don't you think so? |
@koolc test cases are not required, I was just curious if you had anymore crazy URLs that could be sueful for testing ;). Just make the change for |
Thank you! I have seen the merged codes, but they doesn't seem to be completely right. Please see the message left by me on #748 |
@koolc replied |
Bugfix: outgoing url is wrong when the source url is 'http://a.b.c/d/??e/a.js,f/b.js,g/c.js?t=123456' (a combo url).