MystenLabs / walrus-sites

Walrus Sites: Decentralized Websites using Sui and Walrus.
https://docs.walrus.site/walrus-sites/intro.html
Apache License 2.0
17 stars 16 forks source link

feat(service-worker): track seen resources to avoid infinite redirect loops #120

Closed Tzal3x closed 1 month ago

Tzal3x commented 1 month ago

When recursively redirecting to the object ids of a Display, keep track of the "visited" object ids to avoid infinite loops. Source: https://github.com/MystenLabs/walrus-sites/pull/58#discussion_r1635253806

Also refactored the return type of the fetchResource function It would return null for cases where the resource would not be able to load.

This is not ideal, since we need to be more expressive with our responses (we introduce another error of INFINITE_LOOPS 508 and 310 for maximum number of redirects reached).

Using an http status codes enum enables us to propagate the nature of those errors to the response of fetchPage.

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
walrus-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2024 3:23pm
giac-mysten commented 1 month ago

Thanks for the PR @Tzal3x ! just a few questions and minor fixes from my side