There is a known issue with zip Static Resources that prevents files with whitespace in their names from being extracted (I suppose the Static Resource web service on SFDC cannot handle whitespaces). In light of this, what options do we have to access JSON files (containing whitespace in their names) from a zip Static Resource in Apex?

Visualforce is suffering from the same issue so I cannot use Page.Name.getContent(). In Aura the same issue is present (since we'd need to make an explicit GET request to the Static Resource web service). In LWC the platformResourceLoader module only offers loadScript and loadStyle. There' nothing to load a JSON file.

  • I think the solution is "don't use whitespace". That's not very fun, though. Have you tried replacing the space with either "+" or "%20"?
    – sfdcfox
    Apr 16, 2020 at 4:45
  • @sfdcfox Yes. Neither has worked (404 error returned). Unfortunately this zip file is coming from an external API and we don't have control over it. For background, the goal is to unzip this file. I tried using Zippex but ran into CPU timeout. Now I'm trying to use the built-in unarchiver in Static Resources to get the job done.
    – Mossi
    Apr 16, 2020 at 6:33
  • I think you could download the file to the client via XMLHttpRequest, then unzip via jszip and handle on the client. This would work in Visualforce, Aura, and LWC.
    – sfdcfox
    Apr 16, 2020 at 12:43
  • @sfdcfox Using jszip was actually my last option. I wanted to be sure it was not possible to do it without resorting to an external lib. But now that you've said it I'm going to try it out with jszip.
    – Mossi
    Apr 16, 2020 at 18:12
  • What if you used Zippex, but did it asynchronously in a Queueable? The class could fire off a Platform Event when the results are ready. Or, I guess if you were really in a bind, a quick Heroku App could do the heavy lifting for you.
    – sfdcfox
    Apr 16, 2020 at 18:24

1 Answer 1


My workaround was to rename the files, replacing spaces with %20. So if the static resource was:

"images.zip/large image.png"

it became

  • I'm afraid that if the author had had the option to rename files, he would have just removed whitespaces (@discussion in comments) Apr 29, 2022 at 7:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .