Skip to content

Bug Fixes#706

Merged
xzzy merged 8 commits intodbca-wa:mainfrom
oakdbca:data-migration-1
Mar 12, 2026
Merged

Bug Fixes#706
xzzy merged 8 commits intodbca-wa:mainfrom
oakdbca:data-migration-1

Conversation

@oakdbca
Copy link
Member

@oakdbca oakdbca commented Mar 12, 2026

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

@oakdbca oakdbca requested a review from a team March 12, 2026 04:20
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);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Collaborator

@xzzy xzzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sensitivity Check completed

@xzzy xzzy merged commit 2b56ee0 into dbca-wa:main Mar 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants