[BACKLOG-194] - Refactor and unit tests for FileResource.doGetFileOrDir