Skip to content

Support custom URLs in source-info.js without baseUrl concatenation #923

@teslajoy

Description

@teslajoy

In sites/avivator/src/source-info.js, the export always concatenates baseUrl with path.

This prevents using custom/external URLs (ex. http://localhost:8000/file.ome.tiff) without modifying the export logic, since it creates invalid URLs like:

https://viv-demo.storage.googleapis.com/http://localhost:8000/file.ome.tiff

Use Case:
When testing local files or using custom endpoints (local servers, different cloud providers, proxy endpoints), users need to provide complete URLs that shouldn't be prefixed with baseUrl.

Proposed Solution:
Check if urlOrFile already exists before constructing from baseUrl:

export default sources.map(s => ({
  urlOrFile: s.urlOrFile || `${baseUrl}/${s.path}`,
  description: s.description,
  offsets: s.offsets
}));

This maintains backward compatibility while allowing:

const sources = [
  {
    // custom url - not concatenated
    urlOrFile: 'http://localhost:8000/test.ome.tiff',
    description: 'Local test file',
    offsets: 'http://localhost:8000/test.offsets.json'
  },
  {
    // existing behavior - uses baseUrl
    path: 'demo-file.ome.tif',
    description: 'Demo file'
  }
];

Benefits

  • Enables local development/testing without code modification
  • Supports multiple storage backends
  • Backward compatible with existing demo sources
  • Also preserves offsets field which is currently dropped

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions