bevy/crates
Rob Parrett 0fca6938ea
Fix missing meta files breaking Bevy on itch (#19268)
# Objective

Fixes #19029 (also maybe sorta #18002, but we may want to handle the SPA
issue I outlined there more gracefully?)


## Solution

The most minimal / surgical approach I could think of, hopefully
cherry-pickable for a point release.

It seems that it's not *entirely* crazy for web services to return 403
for an item that was not found. Here's an example from [Amazon
CloudFront
docs](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/http-403-permission-denied.html#s3-origin-403-error).
If it is somewhat common for web services to behave this way, then I
think it's best to also treat these responses as if they were "not
found."

I was previously of the opinion that any 400 level error "might as well"
get this treatment, but I'm now thinking that's probably overkill and
there are quite a few 400 level statuses that would indicate some
problem that needs to be fixed, and interpreting these as "not found"
might add confusion to the debugging process.

## Testing

Tested this with a web server that returns 403 for requests to meta
files.

```bash
cargo run -p build-wasm-example -- --api webgl2 sprite && \
open "http://localhost:4000" && \
python3 test_403.py examples/wasm
```
`test_403.py`:
```python
from http.server import HTTPServer, SimpleHTTPRequestHandler
import os
import sys


class CustomHandler(SimpleHTTPRequestHandler):
    def do_GET(self):
        if self.path.endswith(".meta"):
            self.send_response(403)
            self.send_header("Content-type", "text/plain")
            self.end_headers()
            self.wfile.write(b"403 Forbidden: Testing.\n")
        else:
            super().do_GET()


if __name__ == "__main__":
    if len(sys.argv) != 2:
        print(f"Usage: {sys.argv[0]} <directory>")
        sys.exit(1)

    os.chdir(sys.argv[1])

    server_address = ("", 4000)
    httpd = HTTPServer(server_address, CustomHandler)
    httpd.serve_forever()
```

---------

Co-authored-by: Alice Cecile <alice.i.cecile@gmail.com>
Co-authored-by: Ben Frankel <ben.frankel7@gmail.com>
Co-authored-by: François Mockers <francois.mockers@vleue.com>
2025-05-30 20:33:47 +00:00
..
bevy_a11y Bump accesskit to 0.19 and accesskit_winit to 0.27 (#19160) 2025-05-26 17:48:36 +00:00
bevy_animation Adopt consistent FooSystems naming convention for system sets (#18900) 2025-05-06 15:18:03 +00:00
bevy_anti_aliasing Remove Shader weak_handles from bevy_anti_aliasing. (#19391) 2025-05-27 03:14:55 +00:00
bevy_app Mention in .add_observer() docs that first parameter must be a Trigger (#19315) 2025-05-26 20:06:08 +00:00
bevy_asset Fix missing meta files breaking Bevy on itch (#19268) 2025-05-30 20:33:47 +00:00
bevy_audio Allow restricting audio playback to a custom region (#19400) 2025-05-29 18:45:37 +00:00
bevy_color More uninlined_format_args fixes (#19396) 2025-05-28 02:35:18 +00:00
bevy_core_pipeline Remove Shader weak_handles from bevy_core_pipeline (except two). (#19395) 2025-05-27 22:32:27 +00:00
bevy_derive Remove upcasting methods + Cleanup interned label code (#18984) 2025-05-26 15:38:12 +00:00
bevy_dev_tools Improve visibility of debug picking node (#18990) 2025-05-26 15:39:49 +00:00
bevy_diagnostic Rename Timer::finished and Timer::paused to is_finished and is_paused (#19386) 2025-05-27 22:24:18 +00:00
bevy_dylib
bevy_ecs Fix EntityCloner replacing required components. (#19326) 2025-05-30 19:28:53 +00:00
bevy_encase_derive
bevy_gilrs refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
bevy_gizmos Remove Shader weak_handles from bevy_gizmos. (#19394) 2025-05-27 22:32:32 +00:00
bevy_gltf Make sure that serde_json::Map::into_values exists (#19229) 2025-05-26 19:38:28 +00:00
bevy_image Optional explicit compressed image format support (#19190) 2025-05-26 18:00:33 +00:00
bevy_input Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_input_focus Navigate through TabGroups in order. (#19218) 2025-05-26 19:32:10 +00:00
bevy_internal Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_log refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
bevy_macro_utils Better macro errors for get_struct_fields (#17639) 2025-05-26 16:57:03 +00:00
bevy_math More uninlined_format_args fixes (#19396) 2025-05-28 02:35:18 +00:00
bevy_mesh
bevy_mikktspace fix new nightly lint on mikktspace (#18988) 2025-04-30 05:19:01 +00:00
bevy_pbr Fixed memory leak in bindless material (#19041) 2025-05-30 19:36:56 +00:00
bevy_picking Updating mesh_picking doc to include RenderAssetUsages (#19413) 2025-05-29 18:44:50 +00:00
bevy_platform refactor(utils): move SyncCell and SyncUnsafeCell to bevy_platform (#19305) 2025-05-27 04:57:26 +00:00
bevy_ptr
bevy_reflect More uninlined_format_args fixes (#19396) 2025-05-28 02:35:18 +00:00
bevy_remote Make sure that serde_json::Map::into_values exists (#19229) 2025-05-26 19:38:28 +00:00
bevy_render Remove ArchetypeComponentId and archetype_component_access (#19143) 2025-05-27 19:04:32 +00:00
bevy_scene Fix #19219 by moving observer triggers out of resource_scope (#19221) 2025-05-30 19:33:47 +00:00
bevy_sprite Remove Shader weak_handles from bevy_sprite. (#19392) 2025-05-27 04:01:34 +00:00
bevy_state Loosen add_state_scoped_event trait bound. (#19401) 2025-05-29 21:37:53 +00:00
bevy_tasks
bevy_text Remove apostrophes in possessive its (#19244) 2025-05-26 19:53:14 +00:00
bevy_time Rename Timer::finished and Timer::paused to is_finished and is_paused (#19386) 2025-05-27 22:24:18 +00:00
bevy_transform Simplify bevy_utils Features (#19090) 2025-05-24 01:46:11 +00:00
bevy_ui Rename Position to UiPosition in bevy_ui (#19422) 2025-05-29 14:52:44 +00:00
bevy_utils fix reference in example usage comments (#19434) 2025-05-29 19:12:55 +00:00
bevy_window Allow unfocused window creation (#19237) 2025-05-26 20:05:33 +00:00
bevy_winit Allow unfocused window creation (#19237) 2025-05-26 20:05:33 +00:00