It might be convenient to allow modules to alter the URL redirected to from a /document/xxx request - my use case was that a client needed draft versions of documents, in which case the filefield path was altered with a '/draft/' prefix - while a published revision was still live. For some reason (content moderation not fully supported with media?), the file URL for a live media was generated from the latest (draft) revision, so an alter was needed to remove the draft prefix.
Attached patch adds a URL alter hook and .api.php file.
Needs review
1.0
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.