public bool ValidateStylesheet(IStylesheet stylesheet) { // get full path string fullPath; try { // may throw for security reasons fullPath = FileSystem.GetFullPath(stylesheet.Path); } catch { return(false); } // validate path and extension var validDir = SystemDirectories.Css; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var isValidExtension = _ioHelper.VerifyFileExtension(stylesheet.Path, ValidExtensions); return(isValidPath && isValidExtension); }
public bool ValidateScript(IScript script) { // get full path string fullPath; try { // may throw for security reasons fullPath = FileSystem.GetFullPath(script.Path); } catch { return(false); } // validate path & extension var validDir = SystemDirectories.Scripts; var isValidPath = _ioHelper.VerifyEditPath(fullPath, validDir); var validExts = new[] { "js" }; var isValidExtension = _ioHelper.VerifyFileExtension(script.Path, validExts); return(isValidPath && isValidExtension); }