[SalesForce] Unable to access nested files in static resource

I have a zip file containing images as a static resource. After repackaging the zip and uploading a new copy I'm no longer able to access the contents from VisualForce pages.

I access the image like this in the VF page:

<apex:image url="{!URLFOR($Resource.Doc_images, 'image.png')}"/>

That worked fine originally, but after updating the zip the image can no longer be found. The static resource is there and I can download it from <server>/resource/<id>/MyNamespace__Doc_images. The downloaded zip is not corrupted and appears to have the right files inside.

But <server>/resource/<id>/MyNamespace__Doc_images/image.png is not found.

Did anyone experience this before, and is there a solution / workaround?

Best Answer

Turns out when I repackaged the zip I created it with a root directory, for a structure like this:

Root/image.png
...
Root/image-n.png

whereas the original had a flat list:

image.png
...
image-n.png

So of course the files were no longer found. Obvious in retrospect -- but I'll leave the question up in case it helps someone who makes the same mistake...