diff options
| author | uvok | 2025-01-21 20:34:51 +0100 | 
|---|---|---|
| committer | uvok | 2025-01-21 20:34:51 +0100 | 
| commit | 369555b0b6be2a7679af2b52c81558596e7141ec (patch) | |
| tree | 90482cacb5bd3a2a5baf9f982c5501d2c9f5788c | |
| parent | 35891f6eaf8e5eb923cef5a2eb57afb503937936 (diff) | |
Fix: Need to consider 0-byte post for max_id
otherwise a page full of reposts will result
in an infinite loop.
| -rw-r--r-- | hello-fusepy.py | 10 | 
1 files changed, 6 insertions, 4 deletions
diff --git a/hello-fusepy.py b/hello-fusepy.py index 1db302b..175c9a3 100644 --- a/hello-fusepy.py +++ b/hello-fusepy.py @@ -82,6 +82,7 @@ class ActivityPubStatusProvider(StatusProvider):                  None,              ) +        # consider reposts for getting max_id...          ss = [              Status(                  s["object"]["id"].split("/")[-1], @@ -92,9 +93,9 @@ class ActivityPubStatusProvider(StatusProvider):              if s.get("type", None) == "Create"              and "object" in s              and all(key in s["object"] for key in ["id", "content", "published"]) -            and len(s["object"]["content"])          ] -        return ss, ss[-1].id +        # ... but don't return it +        return [s for s in ss if len(s.content)], ss[-1].id  class MastodonStatusProvider(StatusProvider): @@ -137,6 +138,7 @@ class MastodonStatusProvider(StatusProvider):              logging.error("Request error: %s", e)              return self._fallback_error(getattr(e, "message", str(e))), None          statuses = res.json() +        # consider reposts for getting max_id...          ss = [              Status(                  s["id"], @@ -145,9 +147,9 @@ class MastodonStatusProvider(StatusProvider):              )              for s in statuses              if all(key in s for key in ["id", "content", "created_at"]) -            and len(s["content"])          ] -        return ss, ss[-1].id +        # ... but don't return it +        return [s for s in ss if len(s.content)], ss[-1].id  class StatusFileSystem(Operations, LoggingMixIn):  | 
