utils: handle permanent redirect for downloads