Skip to content
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

Apache 2.0 LICENSE file detected as NBT #2266

Open
jpenilla opened this issue Mar 22, 2024 · 2 comments
Open

Apache 2.0 LICENSE file detected as NBT #2266

jpenilla opened this issue Mar 22, 2024 · 2 comments

Comments

@jpenilla
Copy link

Minecraft Development for IntelliJ plugin version

2023.3-1.7.3

IntelliJ version

IntelliJ IDEA 2023.3.6 (Ultimate Edition) Build #IU-233.15026.9, built on March 20, 2024

Operating System

macOS 14.4

Target platform

No response

Description of the bug

Apache 2.0 LICENSE files often get detected as NBT files and need to have the file type manually overridden to plain text.
Screenshot 2024-03-21 at 9 58 46 PM
Screenshot 2024-03-21 at 9 58 55 PM

@Earthcomputer
Copy link
Member

The license file has no file extension so mcdev then checks to see if the first 10kb of the file can be interpreted as NBT.
The first byte of the Apache 2.0 license is 10 (newline) if you are using unix line endings, which coincidentally is the same as the compound tag ID, which is what is required at the top level of the NBT. I can imagine that from here it's quite easy to produce text files that look like valid NBT for the first 10kb, because the next step is to read the next two bytes as a big-endian length for a string to read.

@sylv256
Copy link

sylv256 commented Mar 22, 2024

Now all we have to do is make an NBT polyglot license...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants