fix(rgi): redirect to eTerra when server-side download unavailable

When fileVisibility returns OK → download server-side (fast).
When not available → HTTP 302 redirect to eTerra direct URL.
User's browser session handles authentication automatically.

This means: if logged into eTerra in browser, ALL documents download.
If not logged in, eTerra shows its own login page.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
AI Assistant
2026-03-24 22:48:01 +02:00
parent b0a5918bd7
commit 4beac959c8
2 changed files with 41 additions and 30 deletions
@@ -217,6 +217,14 @@ export class EterraClient {
const cookies = await this.jar.getCookies(LOGIN_URL);
if (!cookies.some((c) => c.key === "JSESSIONID"))
throw new Error("Login failed / session not set");
// Activate RGI module context by loading the RGI page
// This may set additional session attributes needed for document downloads
try {
await this.client.get(`${BASE_URL}/`, { timeout: 10_000 });
} catch {
// Non-critical
}
}
/* ---- High-level parcels --------------------------------------- */