Skip to content

fix(storage): enable storage features when using default GCS endpoint#3135

Merged
marevol merged 1 commit into
masterfrom
fix/gcs-storage-enabled-detection
May 21, 2026
Merged

fix(storage): enable storage features when using default GCS endpoint#3135
marevol merged 1 commit into
masterfrom
fix/gcs-storage-enabled-detection

Conversation

@marevol
Copy link
Copy Markdown
Contributor

@marevol marevol commented May 21, 2026

Summary

The admin UI's storageEnabled flag previously required a non-blank storage.endpoint, which hid storage-dependent features (e.g. thumbnail/asset storage admin links) whenever GCS was used with the default storage.googleapis.com host. This change recognizes GCS-with-default-endpoint as a valid enabled configuration and stops GcsStorageClient from treating the default host as a custom endpoint.

Changes Made

  • SystemHelper: extracted a new isStorageEnabled(FessConfig) helper. Storage is now enabled when storage.bucket is set AND either storage.endpoint is non-blank or storage.type is gcs (case-insensitive). setupStorageInfo delegates to this helper.
  • GcsStorageClient:
    • Added isDefaultEndpoint(String) to detect the default GCS host (storage.googleapis.com, HTTPS, default port). Custom-host/NoCredentials overrides are now skipped when the configured endpoint matches the default, so real Google credentials are used.
    • Added a protected no-arg constructor so subclasses can override behavior without instantiating the underlying GCS client; close() short-circuits when storage is null.
  • Tests:
    • SystemHelperTest#test_isStorageEnabled covers S3-with-endpoint, GCS-without-endpoint (both cases), unrelated type, missing bucket, and null config.
    • New GcsStorageClientTest#test_isDefaultEndpoint covers bare host, scheme/path variants, explicit default port, plus negative cases (HTTP, non-default port, hostname embedded in path).

Testing

  • mvn test -Dtest=SystemHelperTest
  • mvn test -Dtest=GcsStorageClientTest

Breaking Changes

None. The previous behavior is preserved whenever an explicit endpoint is configured; only the GCS-default-endpoint case becomes "enabled" instead of "disabled".

Additional Notes

  • The default-endpoint detection deliberately matches only HTTPS on the default port so that fake-gcs-server / emulator configurations (typically HTTP and/or a custom port) continue to receive NoCredentials and the host override.
  • isStorageEnabled is intentionally null-safe so callers don't have to guard against an uninitialized FessConfig.

The admin UI flag `storageEnabled` previously required a non-blank
`storage.endpoint`, which hid storage features when GCS was used with
the default `storage.googleapis.com` host. Treat GCS as enabled when a
bucket is configured even without an explicit endpoint, and skip the
custom-host override in `GcsStorageClient` for the default endpoint so
real Google credentials are used instead of `NoCredentials`.
@marevol marevol self-assigned this May 21, 2026
@marevol marevol added the bug label May 21, 2026
@marevol marevol added this to the 15.7.0 milestone May 21, 2026
@marevol marevol merged commit 89e65a8 into master May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant