/// <summary> /// Creates <see cref="IHierarchyItemAsync"/> instance by path. /// </summary> /// <param name="path">Item relative path including query string.</param> /// <returns>Instance of corresponding <see cref="IHierarchyItemAsync"/> or null if item is not found.</returns> public override async Task <IHierarchyItemAsync> GetHierarchyItemAsync(string path) { path = path.Trim(new[] { ' ', '/' }); //remove query string. int ind = path.IndexOf('?'); if (ind > -1) { path = path.Remove(ind); } if (!await DataLakeStoreService.ExistsAsync(path)) { Logger.LogDebug("Could not find item that corresponds to path: " + path); return(null); // no hierarchy item that corresponds to path parameter was found in the repository } IHierarchyItemAsync item; if (await DataLakeStoreService.IsDirectoryAsync(path)) { item = await DavFolder.GetFolderAsync(this, path); } else { item = await DavFile.GetFileAsync(this, path); } return(item); }
/// <summary> /// Creates <see cref="IHierarchyItemAsync"/> instance by path. /// </summary> /// <param name="path">Item relative path including query string.</param> /// <returns>Instance of corresponding <see cref="IHierarchyItemAsync"/> or null if item is not found.</returns> public override async Task <IHierarchyItemAsync> GetHierarchyItemAsync(string path) { path = path.Trim(new[] { ' ', '/' }); //remove query string. int ind = path.IndexOf('?'); if (ind > -1) { path = path.Remove(ind); } try { if (!await DataLakeStoreService.ExistsAsync(path)) { Logger.LogDebug("Could not find item that corresponds to path: " + path); return(null); // no hierarchy item that corresponds to path parameter was found in the repository } } catch (RequestFailedException ex) { // token is not valid or access is denied if (ex.Status == 401) { await HttpContext.SignOutAsync(); return(null); } else { throw ex; } } IHierarchyItemAsync item; if (await DataLakeStoreService.IsDirectoryAsync(path)) { item = await DavFolder.GetFolderAsync(this, path); } else { item = await DavFile.GetFileAsync(this, path); } return(item); }