X Tutup
Skip to content

Open compressed files that were not made by godot #28999

@xelivous

Description

@xelivous

Godot version: 33897d9

OS/device including version: Linux 4.14.113-1-MANJARO

Issue description:

I was trying to load a gzipped json file from an external web server, and found out that I can't seem to find a way to do so in godot without making a gdnative plugin. File has the method open_compressed() which supports gzip, but the format it expects for gzip has this bizarre gcpf magic header that encapsulates the format.
Screenshot_2019-05-19_05-54-52

I kind of expected that it would at the very least open up compressed files that weren't made using the godot editor, assuming encryption wasn't used, considering at the end of the day it's just a bunch of strings or whatever other bytes in there. I'm not sure why the magic header exists in the compression format, but ideally if it could fall back to not requiring the magic header at all and just open up the file without it instead that would be cool.

If I ever need to edit a gzipped file that godot has made i can't just do a quick change from any other archive tools, i'll have to open up godot, open it up, edit it, and then re-export it in order for godot to continue being able to read it which is kind of annoying.

Steps to reproduce:

  1. download a gzip'd file from anywhere or make one yourself using the command line
  2. try and load it into godot using open_compressed or any other manner

Minimal reproduction project:

test_compression.zip

  • there's a test.json.gz file at the root of the project file that was made using gzip on the command line, which has the same contents as the text edit that is in the project.
  • If you click the "save gz" button it will save out a file to user://test.json.gz, and load it with "load gz". you can use this to compare the output that godot is expecting compared to the output from command-line gzip
  • You can try to load the command-line gzip file by clicking the button on the bottom of the text edit, and if it fails it will spit out the error below. It will generally always be error 15 until something changes.
  • There's also a checkbox to verify if the input is valid json or not.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup