Fix a couple AIS cases

This commit is contained in:
Salad Dais
2023-12-22 04:37:37 +00:00
parent 087f16fbc5
commit fb9740003e
2 changed files with 7 additions and 3 deletions

View File

@@ -49,11 +49,15 @@ class SchemaFlagField(SchemaHexInt):
"""Like a hex int, but must be serialized as bytes in LLSD due to being a U32"""
@classmethod
def from_llsd(cls, val: Any, flavor: str) -> int:
return struct.unpack("!I", val)[0]
if flavor == "legacy":
return struct.unpack("!I", val)[0]
return val
@classmethod
def to_llsd(cls, val: int, flavor: str) -> Any:
return struct.pack("!I", val)
if flavor == "legacy":
return struct.pack("!I", val)
return val
class SchemaEnumField(SchemaStr, Generic[_T]):

View File

@@ -22,7 +22,7 @@ class ProxyAssetUploader(AssetUploader):
]
}
async with self._region.caps_client.post('FetchInventory2', llsd=ais_req_data) as resp:
ais_item = InventoryItem.from_llsd((await resp.read_llsd())["items"][0])
ais_item = InventoryItem.from_llsd((await resp.read_llsd())["items"][0], flavor="ais")
# Got it, ship it off to the viewer
message = Message(