Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "vitessce"
version = "3.6.3"
version = "3.6.4"
authors = [
{ name="Mark Keller", email="mark_keller@hms.harvard.edu" },
]
Expand Down
26 changes: 24 additions & 2 deletions src/vitessce/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def get_uid_str(uid):
const e = React.createElement;

function isAbsoluteUrl(s) {
return s.startsWith('http://') || s.startsWith('https://');
return s?.startsWith('http://') || s?.startsWith('https://');
}
const WORKSPACES_URL_KEYWORD = 'https://workspaces-pt';
const OPTIONS_URL_KEYS = ['offsetsUrl', 'refSpecUrl'];
Expand Down Expand Up @@ -201,7 +201,7 @@ def get_uid_str(uid):
...d,
files: d.files.map(f => {
const updatedFileDef = { ...f };
if (!isAbsoluteUrl(f.url)) {
if (f.url && !isAbsoluteUrl(f.url) ) {
// Update the main file URL if necessary.
updatedFileDef.url = `${origin}${baseUrl}${f.url}`;
}
Expand All @@ -214,6 +214,28 @@ def get_uid_str(uid):
updatedOptions[key] = `${origin}${baseUrl}${optionValue}`;
}
});

// Update image URLs if they exist
if ('images' in f.options && Array.isArray(f.options.images)) {
const updatedImages = f.options.images.map(image => {
const updatedImage = { ...image };

if (image.url && !isAbsoluteUrl(image.url)) {
updatedImage.url = `${origin}${baseUrl}${image.url}`;
}

const metadata = { ...image.metadata };
if (metadata?.omeTiffOffsetsUrl && !isAbsoluteUrl(metadata.omeTiffOffsetsUrl)) {
metadata.omeTiffOffsetsUrl = `${origin}${baseUrl}${metadata.omeTiffOffsetsUrl}`;
}

updatedImage.metadata = metadata;

return updatedImage;
});

updatedOptions.images = updatedImages;
}
updatedFileDef.options = updatedOptions;
}
return updatedFileDef;
Expand Down