Replied to a post on github.com :
```PHP message: Known (definitely.cz): notice - PHP  Undefined variable: entity in /home/cn/web/public-099a/IdnoPlugins/IndiePub/Pages/MicroPub/Endpoint.php:133" while reading response header from upstream, client: 184.108.40.206, server: definitely.cz, request: "POST /micropub/endpoint HTTP/2.0", upstream: "fastcgi://unix:/var/run/php/php7.0-fpm.sock:", host: "definitely.cz"```
This sortof implies that ->postMedia() is being called. No object is available at this point. TBH I'm not entirely sure why an event is being triggered here - seems unnecessary.
However, you're getting two loops because the first loop the client is posting the photo data (as opposed to using a url which some other clients use), this is returned and used as a url for the second event where the actual post object is created. I'll double check that this itself doesn't call an attempt to create another file from URL which would seem inefficient as it'd create two copies of files, but either way wouldn't result in duplicate photo posts.