Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/test/url_utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ describe("remapUrl", () => {
expect(remapUri("/allen/aics/example/data.zarr")).toBe("https://vast-files.int.allencell.org/example/data.zarr");
});

it("maps FMS file paths", () => {
expect(remapUri("/allen/programs/allencell/data/proj0/folder/some-data.ome.zarr")).toBe(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible someone coming from a Windows'y world would put this in with a double-forward-slash at the beginning? or do we handle that elsewhere?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do handle this in vole-app currently, yes. I could also copy in the code that handles that if we want to repeat it in both places.

"https://s3.us-west-2.amazonaws.com/production.files.allencell.org/folder/some-data.ome.zarr"
);
});

it("maps example Human Organ Atlas GCS URL", () => {
expect(
remapUri(
Expand Down
5 changes: 4 additions & 1 deletion src/utils/url_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const S3_URL_PREFIX = "s3://";
const GCS_URL_PREFIX = "gs://";
const VAST_FILES_PREFIX = "/allen/aics/";
const VAST_FILES_URL = "https://vast-files.int.allencell.org/";
const FMS_FILES_PREFIX = "/allen/programs/allencell/data/proj0";
const FMS_FILES_URL = "https://s3.us-west-2.amazonaws.com/production.files.allencell.org";

/**
* Remaps non-standard URIs (e.g. S3 (`s3://`), Google Cloud Storage (`gs://`), or
Expand All @@ -19,8 +21,9 @@ export function remapUri(url: string): string {
// remap gs://bucket/key to https://storage.googleapis.com/bucket/key
newUrl = newUrl.replace(GCS_URL_PREFIX, "https://storage.googleapis.com/");
} else if (newUrl.startsWith(VAST_FILES_PREFIX)) {
// remap /allen/aics/... to https://vast-files.int.allencell.org/...
newUrl = newUrl.replace(VAST_FILES_PREFIX, VAST_FILES_URL);
} else if (newUrl.startsWith(FMS_FILES_PREFIX)) {
newUrl = newUrl.replace(FMS_FILES_PREFIX, FMS_FILES_URL);
}

return newUrl;
Expand Down
Loading