-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fixed formatting a file:// URI #8669
Conversation
Thank you so much for the pull request @vividos! I noticed this is your first pull request and I wanted to say welcome to the Cesium community! The Pull Request Guidelines is a handy reference for making sure your PR gets accepted quickly, so make sure to skim that.
Reviewers, don't forget to make sure that:
|
I already signed the CLA, hope the PR updates itself... |
I rebased the changes on current master branch |
@OmarShehata can you take a look at this? Thanks! |
Rebased on latest master |
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.
@vividos I'm planning on testing this and giving it a fuller review by Monday but for now I left a quick style comment.
So I wasn't actually able to verify that this fixes the Cesium ion credit image when building with Cordova and running on my Pixel 3. I set my Cesium base url to
@vividos did you have a different setup than what I described here? I'm not sure why the Cesium ion credit has a blank This is also consistent with the behavior in URI.js. Here's how they do it: |
Omar, I didn't have a chance to test the fix in my own app. I just tried to come up with a fix for my Sandcastle example in the original issue #8665. Is there a minified version of Cesium.js from this PR? Then I could drop this into my app and also test. My guess is that it would behave like your Cordova test, though. About other URIs: I thought about this and also read RFC 3986. With this PR, the mailto: and other URIs should be unaffected by the fix, and only "file" URIs are adjusted (notice the extra "if" in the else part). About fixing the image: In my app it seems this is the only instance where local resources couldn't be resolved. I have no problems referencing other images (as you also suggested) and referencing the Service Workers, which I guess also use the cesium/Source/Scene/CreditDisplay.js Line 490 in cbc0909
|
I just tested with my Android app, an unminified Cesium 1.67 version, my patched URI.toString() and some console.log() lines that the logo variable in CreditDisplay.js line 490 (see above) is correctly formatted. So the fix is valid. The icon doesn't show up, though. Investigating with more console.log calls... |
I think I found the reason why the Unfortunately I don't know why it's working in the browser, but not in the Android WebView... |
@OmarShehata I can confirm that replacing this line fixes showing the image on Android: Line 93 in 5a4a66a
(replaced with: var html = this._html )
I also tested on Windows Firefox, and the What should we do with this PR? I would like to have it in 1.68, even when it doesn't fix #8665 yet. Thanks! |
It's definitely DOMpurify, it strips out all src attributes that don't contain http or https links. I think I will solve the original ticket by manually adding the Ion credit string without a full path. CreditDisplay should recognize it as Ion credit, not showing the other Cesium credit, and DOMpurify will not sanitize a relative link. |
@vividos thank you so much for investigating and resolving this! Can you please add or link to your conclusions here in the original issue #8665 ? So someone can either suggest or implement a fix based on your findings. There may be other areas in the code that don't correctly handle links without |
For what to do with this PR, @mramato the behavior for parsing URIs with I'm not aware of a way to fix this without modifying the third party code, since |
Omar, I will comment in the initial issue. Thanks! |
@OmarShehata I also rebased this PR on top of master, but it isn't strictly necessary to fix #8665, now that I have PR #8758 in place. What should we do with this PR? |
add the two forward slashes even when the authority part of the URI is empty do this only for "file" scheme, to not break other schemes like mailto: or tel: see RFC 3986 for details
I'm closing this PR, as my initial issue #8665 is fixed. |
add the two forward slashes even when the authority part of the URI is empty
do this only for "file" scheme, to not break other schemes like mailto: or tel:
see RFC 3986 for details
part of a fix for #8665