registry/session: fix panic in GetRemoteImageLayer

Fixes #7860
Fixes #7742
Closes #7739