Merged
Conversation
… include CSRF token
…y in GeoserverUrlAdmin
…ance capabilities fetching with retry logic
Comment on lines
+868
to
+871
| if (!parsedCapabilities.has(layer.geoserver_url)) { | ||
| const parser = new WMSCapabilities(); | ||
| const result = parser.read(cached.text); | ||
| parsedCapabilities.set(layer.geoserver_url, result); |
There was a problem hiding this comment.
Bug: A shared cache for WMS and WMTS capabilities can cause a TypeError if both layer types share a geoserver_url with is_capabilities_url set to true.
Severity: MEDIUM
Suggested Fix
Separate the caches for WMS and WMTS capabilities. For example, use two different Map objects, like parsedWMSCapabilities and parsedWMTSCapabilities, to ensure that the parsing logic for each service type uses its own dedicated cache and avoids data structure conflicts.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: boranga/frontend/boranga/src/components/common/map_functions.js#L868-L871
Potential issue: A shared cache, `parsedCapabilities`, is used for both WMS and WMTS
layers that fetch capabilities. If a WMTS layer and a WMS layer are configured to use
the same `geoserver_url` with `is_capabilities_url: true`, a race condition can occur.
The first layer to populate the cache will store its parsed data structure. When the
second layer type attempts to use this cached data, it will try to access properties
that do not exist on the other's data structure (e.g., WMS code accessing
`result.Capability.Layer.Layer` on a WMTS object), leading to a TypeError and causing
the map to crash.
Did we get this right? 👍 / 👎 to inform future reviews.
xzzy
approved these changes
Mar 12, 2026
Collaborator
xzzy
left a comment
There was a problem hiding this comment.
Sensitivity Check completed
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.
Move from GET to POST now that OCR Datatable has lots of filtering as it was broken with the url being too long
Various fixes to make the map loading more error tolerant
Clean up unused field out of GeoserverURL model
Update fixture to remove unused field and add correct WMTS version