Repository navigation
Add ITemporaryPathProvider to allow more temp file customization - #1675
Conversation
| using var getStream = await response.Content!.ReadAsStreamAsync().ConfigureAwait(false); | ||
| #endif | ||
| using var tempFile = new TemporaryFile(getStream, ".npe.snupkg"); | ||
| using var tempFile = GetTemporaryFile(getStream, extension: ".npe.snupkg", name: fileName); |
There was a problem hiding this comment.
Is there any reason to put .npe. in the filename instead of just using the original file name?
There was a problem hiding this comment.
I didn't want to run until long path issues. .npe.nupkg is less likely than {long ID}.{long version}.snupkg. Additionally, the .snupkg temp file was never triggering the alerts. It was the assembly temp file case.
| { | ||
| } | ||
|
|
||
| public SymbolValidator(IPackage package, string packagePath, IFolder? rootFolder, HttpClient? httpClient, ITemporaryFileProvider? tempProvider) |
There was a problem hiding this comment.
Would it be better to have a default implementation of ITemporaryFileProvider registered in DI instead of null checks and if statements later?
There was a problem hiding this comment.
I didn't want to make assumptions on what the temp file provider would do and instead leave the fully up to the user. Maybe if we get feedback from folks using the Core package on common usage patterns?
My project (NuGet Insights) is getting alerts for some temp files generated by SymbolValidator. I can tell because ".npe" is seen in the file extension, per #1670. I would like a way of fully customizing the temporary files so I can enhance my logging, select specific temporary directory, etc.