public async Task GetImagesFile()

in Webapp/SDAF/Controllers/FileController.cs [427:475]


        public async Task<AppFile> GetImagesFile(string filename, int type, string partitionKey)
        {
            AppFile file = null;
            try
            {
                file = await _appFileService.GetByIdAsync(filename, partitionKey);
            }
            catch
            {
                string newName = filename;

                if (filename.EndsWith("_custom_sizes.json"))
                {
                    newName = filename[(filename.IndexOf("_custom_sizes.json") + 1)..];
                    type = 1;
                }
                if (filename.EndsWith("_custom_naming.json"))
                {
                    newName = filename[(filename.IndexOf("_custom_naming.json") + 1)..];
                    type = 2;
                }

                if (newName.Contains("..") || newName.Contains("/") || newName.Contains("\\"))
                {
                    throw new Exception("Invalid filename");
                }
                else
                {


                    byte[] byteContent = System.IO.File.ReadAllBytes("ParameterDetails/" + newName);

                    using (MemoryStream memory = new(byteContent))
                    {
                        file = new AppFile()
                        {

                            Id = WebUtility.HtmlEncode(filename),
                            Content = byteContent,
                            UntrustedName = filename,
                            Size = memory.Length,
                            UploadDT = DateTime.UtcNow,
                            FileType = type
                        };
                    }
                }
            }
            return file ?? new AppFile();
        }