Repository navigation
OnlyWorlds Unity SDK 0.11.0
World archives follow the folder spec's .owworld section (§4.7): OWWorldArchive.Read (and so LoadInto and the
importer) agrees with the shared conformance fixture set on every one of its 78 cases, as the TypeScript SDK 4.49.0
does. A refusal names its cause from the spec's list, a mimetype marker is read, the default budget is the spec's
floor (500,000 files, 2 GiB), entry names are strict, two names that one disk would merge are found by Unicode simple
case folding pinned at 15.1.0, a world's api block is stripped on read, and Pack writes in code point order. A
minor release because it adds public API (below). Also here: the archive budget, a records producer's own files kept
whole, and entries refused that would not land safely on every disk.
Added
- The
.owworldmarker (folder spec §4.7, OW-6):OWWorldArchive.MediaTypeis the file's media type,
application/vnd.onlyworlds.world+zip.OWWorldArchive.Read(and soLoadIntoand the importer) accepts an
archive whose root holds amimetypeentry with exactly those bytes, never requires one, and refuses one that
holds anything else (another type, a trailing newline, a BOM). - An
.owworldrefusal names its cause:OWFolderFormatException.Reasonis set on every refusal from
OWWorldArchive.Read(and soLoadIntoand the importer) to one cause from folder spec §4.7's shared list,
the constants of the newOWWorldArchiveReason(not_openable,not_a_world,more_than_one,unsafe_path,
too_big,too_many,duplicate,collision,link,method,name,marker), the names the TypeScript
reader and the conformance fixture set use. A folder's refusal leaves it null. The exception type is unchanged.
Changed
- An
.owworldis read within a budget:OWWorldArchive.ReadandLoadInto(and so the importer) refuse an
archive that holds more than 500,000 files or declares more than 2 GiB uncompressed, before inflating anything, and
refuse one with an entry that inflates past the size it declares (a zip bomb's lie), so a hostile file cannot fill
memory. The numbers are folder spec §4.7's floor (OW-15), the size every reader accepts, as
OWWorldArchive.DefaultMaxBytesandDefaultMaxEntries; the newOWWorldArchiveReadOptions(MaxBytes,
MaxEntries), passed toReadorLoadInto, lowers or raises them for one read. The TypeScript SDK's reader
holds 1 GiB and 200,000 files today, below the floor. Its budget rule and test vectors are ported. - An
.owworldentry name must be a plain relative path (folder spec §4.7, OW-16, ruled strict):
OWWorldArchive.Read(and soLoadIntoand the importer) refuses an archive with an entry name that holds a
backslash, or has an empty,.or..segment, whatever it would resolve to. Before,w\x.json,
w//x.json,w/./x.jsonandw/a/../x.jsonwere resolved and read; one name with two spellings is a file two
readers can take for different entries. The TypeScript reader's rule. - A read strips an
.owworld'sapiblock (folder spec §4.7, OW-10):OWWorldArchive.Read(and soLoadInto
and the importer) no longer returns it inWorld, so a world read from an archive is neverIsSyncableand its
ServerWorldIdis its own id. The file is still read: refusing it would strand a person's own leaked copy. The
TypeScript reader's behaviour.Pack'skeepApiBlock: truestill keeps the block, and its doc now says what the
spec does: such a file is a private copy, not a portable.owworld.
Fixed
-
world.json'sidmust be a non-empty string, as the folder spec requires (§4.1): a folder read, an archive read
andOWWorldArchive.Packrefuse anidthat is a number, a boolean, a list or blank (" "). Before,7was read
as the id"7"and a blank id passed. The TypeScript reader refuses the same. -
OWWorldArchive.Packkeeps a producer's ownx.metabeside itsxinrecords/, byte for byte (§4.5 rule 6).
It left out every.metanamed after a file or folder beside it as Unity's; now only one that opens as Unity
writes them (fileFormatVersion:, then aguid:line) is left out. -
OWWorldArchive.Read(and soLoadIntoand the importer) refuses an.owworldwhose entries would not land
safely on every disk, anywhere in the archive, not only in the world's folder:- two entries of one name (before, only inside the world's folder);
- two names that are one once case and Unicode normalization (NFC) are ignored, files or folders (
Ana.json
besideana.json;caféin NFC beside NFD;Elements/besideelements/): one file on Windows and macOS.
The fold is the one folder spec §4.7 rules for every reader (OW-18): NFC, then Unicode simple case folding
(CaseFolding.txt's C and S rows at Unicode 15.1.0, the version the spec pins, so every reader folds the same
letters), from a table generated bytools/gen_casefold.pyfrom the copy the conformance fixture set vendors,
so it is the same on every runtime and never the runtime's culture data. Soςmeetsσ,ſmeetssand
Cherokee's small letters meet its capitals, whileßstays apart fromssand the Turkicİandıfromi;
upper-then-lower casing, which Mono gets wrong on 484 code points at 15.1.0, is not used; - a path that is both a file and a folder (
w/mediabesidew/media/a.png); - a symbolic link or special file, by the Unix mode in the entry's external attributes;
- an encrypted entry, by its flag (ZipCrypto was refused only because its header made the size wrong), and an
entry in a method other than stored or deflate (LZMA, deflate64, bzip2): before, an element the runtime could
not inflate was skipped and the read went on, and deflate64 was read where the runtime could; - a Windows device name as a name's stem, with or without an extension (
CON.json,nul.txt,COM1-COM9,
LPT1-LPT9), a name ending in a dot or a space, the characters<>:"|?*or a control character; - a non-ASCII name without the zip's UTF-8 flag, whose spelling is a guess, and a name with the flag whose bytes
are not UTF-8 (the runtime read them as U+FFFD, another name than the one written); - a stored entry whose stored size differs from the size it declares: holding more is the zip bomb's lie, refused
from the directory alone, so inmedia/too, which is never read.
And a second
world.jsoninside the world (w/inner/world.json) is refused as a second world; one under
records/stays a producer's own data. The TypeScript reader also refuses a file-and-folder path and a nested
world.json; it has none of the other checks yet. Each refusal names the entry and why. -
OWWorldArchive.Packwrites entries in the order of their names' UTF-8 bytes (code point order), as folder spec
§4.7 rules (OW-13). It sorted UTF-16 code units, which put a name past U+FFFF (an emoji) before one from U+E000
to U+FFFF (a fullwidth letter), so two writers given one world wrote different bytes.