Validate input to FileResource constructor (#14253)

Change-Id: I7789f2de4cb179dfff936498f58dd6f2e491689b