Register .wdl as text MIME type for RStudio (PHP-130724)#332
Open
Register .wdl as text MIME type for RStudio (PHP-130724)#332
Conversation
RStudio misidentifies .wdl files containing 'import' statements as binary/JavaScript, preventing users from opening them. Fix by registering .wdl as text/x-wdl via the freedesktop shared-mime-info system during post-startup, so extension-based MIME resolution takes priority over content-based detection. Only runs when rstudio-server is present, so non-RStudio apps are unaffected.
yuhuyoyo
approved these changes
Mar 3, 2026
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.
Problem
RStudio misidentifies
.wdlfiles containingimportstatements as binary/JavaScript, preventing users from opening them in the editor. This only affects RStudio — VS Code handles them fine.Root cause: When
.wdlisn't registered as a known MIME type, GIO/libmagic falls back to content-based detection, sees theimportkeyword, infers JavaScript, and RStudio treats it as non-text.Fix
Register
.wdlastext/x-wdlvia the freedesktop shared-mime-info system duringpost-startup.sh. This ensures extension-based MIME resolution takes priority over content-based detection./usr/share/mime/packages/wdl.xmlwith a glob pattern for*.wdlupdate-mime-databaseto rebuild the MIME databaserstudio-serveris present, so non-RStudio apps are unaffectedBoth
r-analysisandr-analysis-aouapps benefit since they both invokepost-startup.sh. Verified that the MIME XML is well-formed and the guard condition correctly scopes to RStudio environments.Validation Plan
Validation Plan: PHP-130724 — Register .wdl as text MIME type for RStudio
1. CI smoke test (automatic)
test-pr.yamlworkflowr-analysissmoke test passesr-analysis-aousmoke test passesvscode) still pass2. Local devcontainer build
/usr/share/mime/packages/wdl.xmlexists in the container:3. MIME resolution check
.wdlfile with animportstatement inside the container:xdg-mime query filetype /tmp/main.wdlreturnstext/x-wdl(notapplication/javascript)file --mime-type /tmp/main.wdlreturns atext/*type4. RStudio Server UI test
localhost:8787.wdlfile withimportstatementsworkflows/main.wdlin the RStudio file browser.wdlfiles (withoutimport) also still open normally5. Workbench deployment test
r-analysisapp in a Workbench workspace using the branch image.wdlfilesmain.wdl(the file containingimportstatements) in the RStudio file browser6. Negative testing
post-startup.shdoes not create/usr/share/mime/packages/wdl.xmlon a VS Code or Jupyter app (thecommand -v rstudio-serverguard should skip it)PHP-130724