Пример #1
0
        public async Task <IActionResult> PropFind(string url = null)
        {
            Log("Url: " + url);
            var doc = await GetRequestDocument();

            var dr = new PropFindRequest(doc);

            if (dr.AllProperties && dr.AllPropertiesNames)
            {
                return(BadRequest());
            }

            // special handling for windows miniredir and other who keep asking for root...
            if (string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(FileSystem.Options.BaseUrl))
            {
                return(NoContent());
            }

            if (!CheckUrl(url, out var relativePath))
            {
                return(NotFound());
            }

            Log("RelativePath: " + relativePath);
            if (!FileSystem.TryGetItem(relativePath, out var info))
            {
                return(NotFound());
            }

            var depth = Request.GetDepth();

            Log("Depth: " + depth);
            return(new PropFindResult(info.EnumerateFileSystemInfo(depth), Logger, dr));
        }
Пример #2
0
        public PropFindResult(IEnumerable <IFileSystemInfo> infos, ILogger logger, PropFindRequest request)
        {
            if (infos == null)
            {
                throw new ArgumentNullException(nameof(infos));
            }

            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }

            Infos   = infos;
            Logger  = logger;
            Request = request;
#if DEBUG
            Debug = true;
#endif
        }