Ilie Andriuta the reason it was different for sandbox is because you had specified both a space and a page name in the request whereas /xwiki/bin/downloadrev/TestPage/yourfile.jpg is not a valid attachment URL (space = TestPage, page = yourfile.png).
This message was sent by Atlassian Jira (v9.3.0#930000-sha1:287aeb6)
If image attachments aren't displayed, see this article.