diff --git a/OpenDreamRuntime/Procs/Native/DreamProcNativeWorld.cs b/OpenDreamRuntime/Procs/Native/DreamProcNativeWorld.cs index 88453dc29f..c08d5fb8fd 100644 --- a/OpenDreamRuntime/Procs/Native/DreamProcNativeWorld.cs +++ b/OpenDreamRuntime/Procs/Native/DreamProcNativeWorld.cs @@ -61,8 +61,9 @@ public static async Task NativeProc_Export(AsyncNativeProc.State sta list.SetValue(new DreamValue(header.Key), new DreamValue(header.Value.First())); } + var content = state.ResourceManager.CreateResource(await response.Content.ReadAsByteArrayAsync()); list.SetValue(new DreamValue("STATUS"), new DreamValue(((int) response.StatusCode).ToString())); - list.SetValue(new DreamValue("CONTENT"), new DreamValue(await response.Content.ReadAsStringAsync())); + list.SetValue(new DreamValue("CONTENT"), new DreamValue(content)); return new DreamValue(list); } diff --git a/OpenDreamRuntime/Resources/DreamResourceManager.cs b/OpenDreamRuntime/Resources/DreamResourceManager.cs index 79925a5b74..d7fa2d72e2 100644 --- a/OpenDreamRuntime/Resources/DreamResourceManager.cs +++ b/OpenDreamRuntime/Resources/DreamResourceManager.cs @@ -133,6 +133,18 @@ public IconResource CreateIconResource(byte[] data, Image texture, DMIPa return resource; } + /// + /// Dynamically create a new generic resource that clients can use + /// + /// The resource's data + public DreamResource CreateResource(byte[] data) { + int resourceId = _resourceCache.Count; + DreamResource resource = new DreamResource(resourceId, data); + + _resourceCache.Add(resource); + return resource; + } + /// /// Dynamically create a new icon resource that clients can use ///