Error on DownloadFileAsync with sandbox files id #379
-
Bug ReportOverviewUnable to download sanbox files with FilesEndpoint.DownloadFileAsync. To ReproduceSteps to reproduce the behavior:
Expected behaviorEverything works and the binary will be saved in file system. Screenshots |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Likely you need to use RetrieveFileStreamAsync option so you can save the contents to disk yourself. Is this in a browser app, console, or embedded somewhere else? |
Beta Was this translation helpful? Give feedback.
-
Hi @StephenHodgson, The Path.Combine returns a value that ignore the passed directory and after it try to write the file under C:\mnt\data... with exception. I solved the issue using the RetrieveFileStreamAsync and wrapping the FileResponse.FileName with Path.GetFileName to obtain a valid file path. Thanks for your help. |
Beta Was this translation helpful? Give feedback.
Hi @StephenHodgson,
I'm using the package in a WebAPI. The directory is local (with read/write permission). The problem is the Path.Combine when FileResponse.FileName contains something like "/mnt/data/....". Check my screenshot:
The Path.Combine returns a value that ignore the passed directory and after it try to write the file under C:\mnt\data... with exception. I solved the issue using the RetrieveFileStreamAsync and wrapping the FileResponse.FileName with Path.GetFileName to obtain a valid file path. Thanks for your help.