-
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
3D tiles - always use version query parameter from tileset.json #6933
Conversation
Thanks for the pull request @hpinkos!
Reviewers, don't forget to make sure that:
I am a bot who helps you make Cesium awesome! Contributions to my configuration are welcome. 🌍 🌎 🌏 |
Thanks @hpinkos this fix is definitely what I had in mind. I think we'll need to re-evaluate how Cesium handles query parameters for sub requests, but this definitely makes Cesium more spec compliant when it comes to 3D Tiles. Looks like you have some failing tests. Once they're fixed, I'll merge. |
Alright, I think I got everything with |
Source/Scene/Cesium3DTileset.js
Outdated
} | ||
// Always set query parameters to make sure the tilesetVersion matches the current tileset | ||
// Otherwise a child tileset might use the tilesetVersion from the parent | ||
resource.setQueryParameters(versionQuery); |
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.
Why not just move this inside of the if block?
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.
I literally put an inline comment above this line explaining that
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.
Wait, I'm supposed to read those things?
Unfortunately, there is still an issue because the code doesn't actually remove the parameter. setQueryParameters
only overwrites values if they are supplied, since versionQuery
is an empty object, it's essentially a no-op.
//Assume a query parameter
var url1 = new Cesium.Resource('https://cesium.com?v=1');
console.log(url1.url); // https://cesium.com?v=1
//This is basically a no-op
url1.setQueryParameters({});
console.log(url1.url); // https://cesium.com?v=1
//However, this only clears the value, not the parameter
url1.setQueryParameters({ v: undefined});
console.log(url1.url); // https://cesium.com?v
//To actually delete the query parameter
delete url1.queryParameters.v;
console.log(url1.url); // https://cesium.com
So you need an else that deletes it and you can get rid of the tmp object.
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.
And sorry for not reading your comment.
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.
Ah, yeah I was looking at how setQueryParamaters
works and for some reason I thought that it would remove the value unless you set the useAsDefault
argument, but you're right.
@mramato I think this is ready now |
Thanks @hpinkos! I pushed a minor tweak and will merge when this goes green. |
@mramato This is the fix we want, right?