Skip to content
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

Add Search Paramater Re-Insertion to Child Tile URLs in RealityDataSourceTilesetUrlImpl #7352

Merged
merged 9 commits into from
Nov 13, 2024
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@itwin/core-frontend",
"comment": "",
"type": "none"
}
],
"packageName": "@itwin/core-frontend"
}
7 changes: 6 additions & 1 deletion core/frontend/src/RealityDataSourceTilesetUrlImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ export class RealityDataSourceTilesetUrlImpl implements RealityDataSource {
private _tilesetUrl: string | undefined;
/** For use by all Reality Data. For RD stored on PW Context Share, represents the portion from the root of the Azure Blob Container*/
private _baseUrl: string = "";
/** Need to be passed down to child tile requests when requesting from blob storage, e.g. a Cesium export from the Mesh Export Service*/
private _searchParams: string = "";

/** Construct a new reality data source.
* @param props JSON representation of the reality data source
Expand Down Expand Up @@ -69,8 +71,11 @@ export class RealityDataSourceTilesetUrlImpl implements RealityDataSource {
// otherwise the full path to root document is given.
// The base URL contains the base URL from which tile relative path are constructed.
// The tile's path root will need to be reinserted for child tiles to return a 200
// If the original url includes search paramaters, they are stored in _searchParams to be reinserted into child tile requests.
private setBaseUrl(url: string): void {
const urlParts = url.split("/");
const newUrl = new URL(url);
this._searchParams = newUrl.search;
urlParts.pop();
if (urlParts.length === 0)
this._baseUrl = "";
Expand Down Expand Up @@ -107,7 +112,7 @@ export class RealityDataSourceTilesetUrlImpl implements RealityDataSource {

/** Returns the tile URL. If the tile path is a full URL, it is returned as is. Otherwise, the base URL is prepended to the tile path. */
private getTileUrl(tilePath: string){
return this.isValidURL(tilePath) ? tilePath : this._baseUrl + tilePath;
return this.isValidURL(tilePath) ? tilePath : this._baseUrl + tilePath + this._searchParams;
danieliborra marked this conversation as resolved.
Show resolved Hide resolved
}

/**
Expand Down
Loading