diff options
Diffstat (limited to 'hello-fusepy.py')
-rw-r--r-- | hello-fusepy.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/hello-fusepy.py b/hello-fusepy.py index 1fce36f..dc9117e 100644 --- a/hello-fusepy.py +++ b/hello-fusepy.py @@ -75,7 +75,9 @@ class ActivityPubStatusProvider(StatusProvider): s["object"]["published"], ) for s in status_items - if s["type"] == "Create" + if s.get("type", None) == "Create" + and "object" in s + and all(key in s["object"] for key in ["id", "content", "published"]) ] @@ -98,7 +100,7 @@ class MastodonStatusProvider(StatusProvider): return self._fallback_error(getattr(e, "message", str(e))) user = res.json() - self.userid = user.get("id") + self.userid = user.get("id", None) if not self.userid: return self._fallback_error("Malformed content in querying user ID.") @@ -121,6 +123,7 @@ class MastodonStatusProvider(StatusProvider): s["created_at"], ) for s in statuses + if all(key in s for key in ["id", "content", "created_at"]) ] @@ -143,7 +146,7 @@ class StatusFileSystem(Operations, LoggingMixIn): "st_uid": uid, "st_gid": gid, } - found = next((s for s in self.statuses if "/" + s.id == path), None) + found = next((s for s in self.statuses if s.id == path[1:]), None) if found: published_dt = dtp.fromisoformat(found.published) pubunix = published_dt.timestamp() @@ -176,7 +179,7 @@ class StatusFileSystem(Operations, LoggingMixIn): return self.fd def read(self, path, size, offset, fh): - found = next(s for s in self.statuses if "/" + s.id == path) + found = next(s for s in self.statuses if s.id == path[1:]) if found: return found.content.encode("utf8") raise FuseOSError(errno.ENOENT) |