Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

fix(ResourceUrlResolver) #1557

Closed
wants to merge 5 commits into from
Closed

fix(ResourceUrlResolver) #1557

wants to merge 5 commits into from

Conversation

kevin-sakemaer
Copy link
Contributor

#1543

Change _baseUri for support Chrome App

Change _baseUri for support Chrome App because Uri.base.origin is
limited to scheme who start with http or https
@mhevery
Copy link
Contributor

mhevery commented Oct 14, 2014

Thanks for your contribution! In order for us to be able to accept it, we ask you to sign our CLA (contributor's license agreement). CLA is important for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form): http://code.google.com/legal/individual-cla-v1.0.html

@kevin-sakemaer
Copy link
Contributor Author

Normaly i have already sign your CLA
On Oct 15, 2014 12:44 AM, "Miško Hevery" notifications@github.com wrote:

Thanks for your contribution! In order for us to be able to accept it, we
ask you to sign our CLA (contributor's license agreement). CLA is important
for us to be able to avoid legal troubles down the road.

For individuals (a simple click-through form):
http://code.google.com/legal/individual-cla-v1.0.html


Reply to this email directly or view it on GitHub
#1557 (comment).

@vicb
Copy link
Contributor

vicb commented Oct 15, 2014

@kleak you probably haven't signed the CLA with the email address used for this PR. Could you please re-sign it with the correct email addres ?

Regarding the fix, the code has been modified but not the comment. Could you please update it as well (ie why you're not using Uri.base.origin any more)

change the comment
@kevin-sakemaer
Copy link
Contributor Author

I have signed the CLA yesterday before PR with my github email address so tell my me if it's ok

fix the warning in resolveHtml method
@kevin-sakemaer
Copy link
Contributor Author

@chirayuk the restriction on http/https scheme is needed?
Because when you are in a chrome app the scheme is not http or https but chrome-extension.

@vmendi
Copy link

vmendi commented Nov 1, 2014

I bumped into this problem too when trying to package with phonegap. Looking forward to seeing it integrated into the main branch :).

@naomiblack naomiblack added this to the 1.1 milestone Dec 9, 2014
@naomiblack
Copy link
Contributor

Assigning to chirayu to investigate for unanticipated consequences...

// Ensures that Uri.base is http/https.
final _baseUri = Uri.base.origin + ('/');
// Reconstruct the Uri without the http or https restriction due to Uri.base.origin
final _baseUri = "${Uri.base.scheme}://${Uri.base.authority}" + ('/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if Uri.base.authority is empty and throw and error if it is. To do that, you might make this assigned the result of a calling a static function. (It will be initialized lazily so it won't throw an error when relative url support is disabled.) Otherwise, looks good.

@kevin-sakemaer
Copy link
Contributor Author

what is the format of the error i have to throw?

create _getBaseUri static function for create the _baseUri.
todo: have to change the error throw
if (Uri.base.authority.isEmpty) {
throw "Uri.base.authority is Empty";
} else {
return "${Uri.base.scheme}://${Uri.base.authority}" + ('/');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get rid of the manual string concatenation here and put the "/" inside the 1st string like this:

return "${Uri.base.scheme}://${Uri.base.authority}/";

@chirayuk
Copy link
Contributor

Thanks for the fixes. I added two small comments. LGTM otherwise.

@rkirov
Copy link
Contributor

rkirov commented Jan 14, 2015

merged. Thanks for your contribution!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

8 participants