lune-org/lune

roblox.readPlaceFile is unable to read a file downloaded from Roblox's CDN

Closed this issue · 6 comments

I have attached a repro file to this issue named file. If you rename the file to file.rbxl and open it with Studio, it opens without issue. Though lune's roblox library is unable to parse it.

files_from_cdn.zip

To repro, run the following in lune after unzipping the downloaded file:

local roblox = require("@lune/roblox")

roblox.readPlaceFile("file")

In this file, I get the error Failed to read document from buffer - stream did not contain valid UTF-8 but for other files I'll get Unknown document format

Apologies, I had to zip the file to upload it to github.
I've updated the report to clarify

I can't reproduce "Failed to read document from buffer - stream did not contain valid UTF-8". I see no problems from either lune or rbx-dom (lune's roblox library) after unzipping this file. If I leave your file zipped and then run the lune script, I see Unknown document format, which I expect. I'm not sure how you're getting that first error message.

Can you provide more details on how you're getting this to occur?

Sorry I may have uploaded the wrong file. I've updated the OP with two files for the two different errors

Ran with lune v0.6.6 with RUST_LOG level to trace and got this:
$ RUST_LOG=trace lune test.log

Issue was weird unicode in a RotateP (virus) instance.

Can't see any problem with unknown_document_format in your updated files - it looks to read just fine to me!

I can reproduce the problem with did_not_contain_valid_utf8, and it makes sense. The core of this problem is that Roblox is lax about the data it allows in strings, while rbx-dom and Rust programs in general strictly enforce that strings are always UTF-8 encoded.

I think it's probably pretty uncommon for place/model files in the wild to contain non UTF-8 strings, but if it's really important for your use case that these kinds of files aren't rejected then rbx-dom must do something else about funny-lookin strings. I think it'd be good to come up with some more information about your use case (for example: is it important that the data is preserved 1-1, or would a lossy conversion be ok?) and then open an issue over at rbx-dom

Going to close this issue since it was resolved and is neither a bug nor feature request related to Lune, as mentioned above feel free to create an issue in rbx-dom and discuss over there