-
Notifications
You must be signed in to change notification settings - Fork 173
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
[brainbrowser] Fully remove ajax directory #7824
Merged
Merged
Conversation
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
cmadjar
requested changes
Jan 18, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the getImageName script from the brainbrowser module. The script's only purpose is to return a file's filename, given the FileID after image.php retrieves the file. However, image.php already looks up the filename. image.php passes the FileID in an X-FileID header, so this extends that to add an X-Filename header to pass the name as well as the ID. This is cached in an object and used to update the file template after the volumes are downloaded.
This fixes an issue where image data is downloaded twice by BrainBrowser. The brainbrowser.loris.js file makes a request to image.php to get metadata for the file from http headers, and then passes the URL to brainbrowser which makes a separate data. Replace the GET request with a HEAD request from the LORIS side so that only brainbrowser downloads the data. Resolves aces#7805
This updates brainbrowser in LORIS to get rid of the ajax directory. In doing so, it also updates the architecture to be somewhat more sane. Previously, a request would be made from javascript to an ajax script which takes a FileID and returns the raw file content with some metadata in HTTP headers. This request would be made once per file to be displayed in BrainBrowser. The body of the request would then be discarded, and the same endpoint would be passed to brainbrowser. Brainbrowser would download the file content a second time, and after all files were re-downloaded display the volume viewer. In the new architecture, an imageinfo endpoint is added which returns the metadata in JSON format. Included in the information in the response is a URL which can be passed to brainbrowser to download the raw file data. The LORIS API is used for imaging browser files, and a new endpoint is added to the mri_violations module for files which can not be accessed through the API. The end result is that the ajax directory is no longer used by brainbrowser, the API is used to download files, and some more access checking is done on accessing mri violations files.
driusan
force-pushed
the
RemoveAjaxBrainBrowser2
branch
from
January 18, 2022 18:18
f1092ac
to
cdf1499
Compare
@cmadjar I think I managed to reproduce and fix this problem, can you try again? |
cmadjar
approved these changes
Jan 20, 2022
cmadjar
added
the
Passed Manual Tests
PR has undergone proper testing by at least one peer
label
Jan 20, 2022
This was referenced Jan 20, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This updates brainbrowser in LORIS to get rid of the ajax directory.
In doing so, it also updates the architecture to be somewhat more
sane.
Previously, a request would be made from javascript to an ajax script
which takes a FileID and returns the raw file content with some metadata
in HTTP headers. This request would be made once per file to be displayed in BrainBrowser. The body of the request would then be discarded, and the
same endpoint would be passed to brainbrowser. Brainbrowser would download
the file content a second time, and after all files were re-downloaded
display the volume viewer.
In the new architecture, an imageinfo endpoint is added which returns
the metadata in JSON format. Included in the information in the response
is a URL which can be passed to brainbrowser to download the raw file
data. The LORIS API is used for imaging browser files, and a new endpoint
is added to the mri_violations module for files which can not be accessed
through the API.
The end result is that the ajax directory is no longer used by brainbrowser,
the API is used to download files, and more access checking is
done on accessing mri violations files.