don't check migration status if a file is accessed by a public link

small fix for #6240

stable6/master is not affected.

cc @PVince81 maybe you can have a look at it, I only added the if condition, check the diff with ?w=1.