fix map download and scynchronizaiton#3053
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates how map download links are generated and how the AutoRegistrator syncs/copies maps from springfiles so registered maps are available locally under content/maps for web downloads.
Changes:
- Replaces legacy “mirror list + link validation” logic with a simpler “local file + springfiles availability” link builder (with caching/deduped probing).
- Adds
GlobalConst.SpringfilesBaseUrland removes the oldDefaultDownloadMirrorsmechanism. - Reworks the springfiles map syncer to use the springfiles JSON API and to copy successfully registered maps into the site
content/mapsfolder.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| Zero-K.info/AppCode/ResourceLinkProvider.cs | New link-building + springfiles HEAD-probe caching/dedup logic for resource downloads. |
| Shared/PlasmaShared/GlobalConst.cs | Introduces SpringfilesBaseUrl constant and removes obsolete download-mirror plumbing. |
| AutoRegistrator/WebFolderSync.cs | Switches springfiles listing to JSON API and returns success/failure from downloads. |
| AutoRegistrator/AutoRegistrator.cs | Updates map synchronization flow to ensure registered maps exist locally in content/maps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Case-insensitive FileName match in UploadResource — DB row may have different casing than the freshly-uploaded file (e.g., springfiles vs original-upload casing). Plus null-guards on the resource and contentFile lookups so a missing match logs gracefully instead of NPEing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3051 — featured maps no longer randomly lose their downloads. The old
ResourceLinkProvider.UpdateLinksdid a 2 s HEAD against/content/maps/<file>on every periodic refresh andvalids.Remove(link)on any failure (timeout / momentary 404 / IIS hiccup), zeroingLinkCount. The rewrite uses liveFile.Existsper request for the local URL (never silently destroyed) and a 24 h cached, deduped HEAD probe for the springfiles fallback.Fixes #3052 — case-insensitive
FileNamematch inMapsController.UploadResource, plus null-guards on the resource/contentFile lookups so old maps with mismatched-casing filenames no longer NPE the upload.Other changes
springfiles.springrts.com/json.php(the oldapi.springfiles.comis dead).~/content/maps/so the local mirror is populated.GlobalConst.SpringfilesBaseUrlto centralize the host.ConcurrentDictionary<string, Lazy<bool>>— verified that 30 (and 100) concurrent cold-cache callers result in exactly one HEAD.