Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip temp files for repo updates #4102

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

HebaruSan
Copy link
Member

Problem

Windows users have reported "access denied" errors with %TEMP%\CdFileMgr during repo updates, see #3963:

image

Cause

Repo updates are downloaded to temp files with paths in that folder, which are then loaded back from disk. Some users have found that their anti-virus software was stopping CKAN from accessing these temp files.

Changes

Now repo updates are downloaded into a MemoryStream and processed directly (instead of being saved to disk, then immediately re-loaded and parsed). Since they are around 30 MiB for the biggest repo, this should work fine for everyone, including whomever or whatever is preventing us from reading the temp files.

  • NetAsyncDownloader.DownloadTarget is now an abstract base class with child classes:
    • NetAsyncDownloader.DownloadTargetFile - downloads to a file on disk, replaces previous usages of DownloadTarget, and its default temp file path is now a standard path instead of one in the CdFileMgr folder
    • NetAsyncDownloader.DownloadTargetStream - downloads to a MemoryStream, now used by RepositoryDataManager.Update
  • Various layers of code are updated to no longer handle certain streams with using () {}, since this closes the MemoryStream and makes it inaccessible for processing after download
  • NetAsyncDownloader.DownloadPart.path was redundant with NetAsyncDownloader.DownloadTarget.filename and is now eliminated

@HebaruSan HebaruSan added Enhancement New features or functionality Core (ckan.dll) Issues affecting the core part of CKAN Windows Issues specific for Windows Network Issues affecting internet connections of CKAN labels Jun 6, 2024
@HebaruSan HebaruSan merged commit ea40db1 into KSP-CKAN:master Jun 6, 2024
3 checks passed
@HebaruSan HebaruSan deleted the feature/repo-streams branch June 6, 2024 16:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core (ckan.dll) Issues affecting the core part of CKAN Enhancement New features or functionality Network Issues affecting internet connections of CKAN Windows Issues specific for Windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant