Fixed array detection on public download

When downloading a folder called "0001" PHP should fallback to parsing
it as string and properly detect that it is not a JSON array.

Backport of 6cbabdf217f55df3655143aa82b6e5e74650df05 from master