Created
May 6, 2019 18:06
-
-
Save justin-lyon/c42a90d6106fa7c9c2107470acd87dce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String getResourceContent(StaticResource resource, String fileName) { | |
String modStamp = String.valueOf(((DateTime)resource.SystemModStamp).getTime()); | |
List<String> path = new List<String>(); | |
path.add('/resource'); | |
path.add(modStamp); | |
path.add(resource.Name); | |
path.add(fileName); | |
String url = String.join(path, '/'); | |
// PageReference .getContent() is not Testable. | |
PageReference fileRef = new PageReference(url); | |
return fileRef.getContent().toString(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment