Skip to content

[2.x] Fix isBinary check to correctly indicate certain textual formats as being not binary #15900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 18, 2021

Conversation

Mark-H
Copy link
Collaborator

@Mark-H Mark-H commented Nov 11, 2021

What does it do?

Adjusts the isBinary check to make more file types accepted as being non-binary.

Why is it needed?

This check is used to decide wether or not the files tree should offer the edit option. Some of these, especially json and xml, are not offered the edit option regardless of exension.

How to test

Add a file with some JSON content, for example:

{
   "style_formats":[
      {
         "title":"Red text",
         "inline":"span",
         "styles":{
            "color":"#ff0000"
         }
      }
   ]
}

Note that in the files tree it is not editable (clicking it does nothing).

Apply the patch, and note that now it can be edited.

Related issue(s)/PR(s)

None, was reported in slack and I went straight from debugging to fixing.

@Mark-H Mark-H added this to the v2.8.4 milestone Nov 11, 2021
@Mark-H Mark-H requested a review from opengeek as a code owner November 11, 2021 16:11
@cla-bot cla-bot bot added the cla-signed CLA confirmed for contributors to this PR. label Nov 11, 2021
Mark-H added a commit to Mark-H/revolution that referenced this pull request Nov 11, 2021
…les can be edited

This adds a whitelist of mime types that should be editable.

Also corrects the logic for calls to isFileBinary; a binary file is one that consists of garbage text and should not be edited, but that logic had been flipped in 3.x.
@opengeek opengeek merged commit 1014ed8 into modxcms:2.x Nov 18, 2021
@Mark-H Mark-H deleted the 2.x-fix-isbinary branch April 22, 2022 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed CLA confirmed for contributors to this PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants