Closed acourtneybrown closed 1 year ago
Thanks for reporting this.
Dotdrop will handle files as text as long as their mime type contains text
, json
or empty
.
I tried running the finicky.js
file through file
and python-magic
with different outputs depending on OS/versions. Most of time text/plain
is returned but I also got application/javascript
.
Even though application/javascript
is obsolete (and thus shouldn't happen), I will add an exception for the following mime types so that those files will get handle as text:
ecmascript
javascript
The above commit should fix it for you. Could you test dotdrop from the master branch and let me know if that does it for you?
Yeah, the change above ensures that dotdrop
processes the Javascript file through the template engine. Thanks for the quick help.
@acourtneybrown awesome!
Thanks for your help. I'll release a new version on pypi ASAP and will ping you when done.
@acourtneybrown new version 1.13.2 is available on pypi.
Dotdrop version (and git commit if run from source): v1.13.0 Using dotdrop: from Homebrew
Describe the bug
The
_handle_file
method intemplategen.py
treats files with mime-typeapplication/javascript
as a binary file, thus only copying it directly vs. running the file through the templating engine. I'm uncertain if this recent bug is due to a change indotdrop
or the underlyingmagic
library, as my setup had previously worked with version ofdotdrop
prior to1.13.0_1
(from Homebrew), but now I see the same incorrect behavior with1.13.0
&1.12.13
Steps to Reproduce
Steps to reproduce the behavior:
application/javascript
which also has template directives & has thetemplate
property eithertrue
or inheritedtrue
.dotdrop install
on the fileExpected behavior
The file should be run through the templating engine & the template directives should not appear in the resulting output file.
Additional information
From
acourtneybrown/dotfiles
:which uses
finicky.js
(from the same repo) containingtemplate directives
like:Dotdrop's execution with the debug logs (
--verbose
)contains output showing the misidentification of the
application/javascript
file as not text: