Skip to content

Commit bdb15af

Browse files
committed
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.
1 parent 6f174c9 commit bdb15af

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

startupscript/post-startup.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,18 @@ if command -v rstudio-server &> /dev/null; then
9494
# WDL (Workflow Description Language) files - override JavaScript detection.
9595
# libmagic misidentifies WDL import statements as JavaScript/ES modules,
9696
# which causes RStudio to treat .wdl files as binary.
97+
# Rules for files starting with a version declaration:
9798
0 string version\ 1.0 Workflow Description Language source
9899
!:mime text/plain
99100
0 string version\ 1.1 Workflow Description Language source
100101
!:mime text/plain
101102
0 string version\ draft-2 Workflow Description Language source
102103
!:mime text/plain
104+
# Rule for files starting with an import (no version header).
105+
# This also matches JavaScript ES module files, but reclassifying them
106+
# as text/plain is harmless — they are still text.
107+
0 string import\ " Text source with imports
108+
!:mime text/plain
103109
MAGIC_EOF
104110
fi
105111

0 commit comments

Comments
 (0)