Commit 9252e29
authored
Fix RStudio treating .wdl files as binary via libmagic override (PHP-130724) (#332)
* Register .wdl as text MIME type for RStudio (PHP-130724)
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.
* Move .wdl MIME fix to Dockerfiles for reliability (PHP-130724)
The startup script approach was unreliable because post-startup.sh
could fail before reaching the MIME registration block. Move the fix
to Dockerfiles so it's baked into the container image at build time,
guaranteeing the MIME type is registered before RStudio Server starts.
Changes:
- Create Dockerfile for r-analysis with .wdl MIME type registration
- Update docker-compose.yaml to use build context
- Add MIME fix to r-analysis-aou Dockerfile
- Remove runtime MIME registration from post-startup.sh
* Revert Dockerfile approach; place MIME fix early in post-startup.sh (PHP-130724)
The Dockerfile approach caused build failures because adding build:
to docker-compose.yaml changes how devcontainer CLI applies features
(injecting them as Dockerfile build steps), which conflicts with
/opt/conda already existing in the tidyverse base image.
Instead, register the .wdl MIME type in post-startup.sh at the very
beginning — right after logging setup but before apt-get update and
other network-dependent steps that may fail. This ensures the MIME
type is registered even if later startup steps encounter errors.
* Remove unintended files from commit
* Use libmagic override instead of MIME database for WDL detection (PHP-130724)
Replace shared-mime-info XML registration with a custom /etc/magic rule.
The root cause is that libmagic misidentifies WDL files containing
'import' statements as application/javascript, causing RStudio to
treat them as binary. The magic rule matches WDL version headers
(1.0, 1.1, draft-2) and overrides the MIME type to text/plain.
* Also override libmagic for WDL files starting with import (PHP-130724)
WDL files without a version header that start with an import statement
are also misidentified as application/javascript by libmagic. Add a
catch-all rule for files starting with 'import "'. Reclassifying
JavaScript ES modules as text/plain is harmless.
* Remove mkdir for /etc/magic — it already exists as a file (PHP-130724)
/etc/magic is a regular file used by libmagic for custom rules, not a
directory. The mkdir -p call fails when the file already exists, causing
the post-startup script to exit with an error.1 parent c0c151c commit 9252e29
1 file changed
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
82 | 111 | | |
83 | 112 | | |
84 | 113 | | |
| |||
0 commit comments