-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3226 from OpenNeuroOrg/3225-file-viewer-load-fix
fix(app): Prevent loading files for viewers with built in data transfer
- Loading branch information
Showing
4 changed files
with
34 additions
and
5 deletions.
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
packages/openneuro-app/src/scripts/dataset/files/__tests__/file-types.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { isNifti, isNwb } from "../file-types" | ||
|
||
describe("isNifti()", () => { | ||
it("detects nifti files", () => { | ||
expect(isNifti("sub-01/anat/sub-01_T1w.nii.gz")).toBeTruthy() | ||
expect(isNifti("dataset_description.json")).toBeFalsy() | ||
}) | ||
}) | ||
describe("isNwb()", () => { | ||
it("detects nwb/edf files", () => { | ||
expect(isNwb("eeg/sub-5_task-oa_eeg.edf")).toBeTruthy() | ||
expect(isNwb("eeg/sub-cbm009_task-protmap_eeg.edf")).toBeTruthy() | ||
expect(isNwb("sub-01/anat/sub-01_T1w.nii.gz")).toBeFalsy() | ||
}) | ||
}) |
10 changes: 10 additions & 0 deletions
10
packages/openneuro-app/src/scripts/dataset/files/file-types.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
export function isNifti(path) { | ||
return path.endsWith(".nii.gz") || | ||
path.endsWith(".nii") || | ||
path.endsWith(".mgh") || | ||
path.endsWith(".mgz") | ||
} | ||
|
||
export function isNwb(path) { | ||
return path.endsWith(".edf") || path.endsWith(".nwb") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters