Auto detect webpage-like files as needing browser viewer - #859
Draft
SeanDuHare wants to merge 6 commits into
Draft
Auto detect webpage-like files as needing browser viewer#859SeanDuHare wants to merge 6 commits into
SeanDuHare wants to merge 6 commits into
Conversation
SeanDuHare
commented
Jun 30, 2026
| return [ | ||
| { | ||
| ...apps.browser, | ||
| text: `Browser (${hostname})`, |
Contributor
Author
There was a problem hiding this comment.
I wonder if just text: hostname would be better UX?
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds automatic detection of “webpage-like” linked file paths so BioFile Finder can offer a contextual Browser () viewer option when the target appears to be HTML, while also refactoring cloud-object metadata retrieval from “size-only” to “type + size”.
Changes:
- Replace cloud size-only lookup with
getCloudObjectInfo()returning{ type, size }(including webpage/image detection via HTTP headers). - Update “Open with” menu logic to prefer a Browser option when detected content type is
webpage. - Update download logic to use the new object-info API when populating missing sizes.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| packages/core/state/interaction/logics.ts | Switches download pre-processing to fetch cloud object info (size) via the new API. |
| packages/core/services/S3StorageService/index.ts | Introduces getCloudObjectInfo() and HTTP-based type/size detection logic. |
| packages/core/hooks/useOpenWithMenuItems/index.tsx | Tracks detected content type and prioritizes Browser viewer for webpage-like links. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
314
to
318
| if (!file.size) { | ||
| file.size = await s3StorageService.getCloudObjectSize(file.path); | ||
| const { size } = await s3StorageService.getCloudObjectInfo(file.path); | ||
| file.size = size; | ||
| if (file.size === undefined) someFilesHaveUnknownSize = true; | ||
| } |
This file contains hidden or 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
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.
Context
Some users want to have their rows represent webpages or like for IDR want to supply the file in the context of their own viewer.
Changes
The Column Descriptions feature (where you tell BFF which columns represent links) handles this more explicitly. However, it seems like a nice to have to have BFF auto-detect when a linked "File Path" is a webpage - when it is able to do so it will supply "Browser ()" as the "Open with" option. For example, if we remove the IDR specialized handling it would render "Browser (idr.openmicroscopy.org)" as the option.
Testing
This feature only works if BFF is able to reach out to the web page via a HEAD (ideal) or GET request which requires CORS to be enabled for BFF on the webpage.