Skip to content

feat(storage): add StringLoader to support loading gs:// URL strings directly via Glide#2335

Merged
demolaf merged 2 commits into
masterfrom
fix/storage-string-loader
Jun 17, 2026
Merged

feat(storage): add StringLoader to support loading gs:// URL strings directly via Glide#2335
demolaf merged 2 commits into
masterfrom
fix/storage-string-loader

Conversation

@demolaf

@demolaf demolaf commented Jun 17, 2026

Copy link
Copy Markdown
Member

Closes #1842 .

Changes

FirebaseImageLoader previously only accepted a StorageReference as the Glide model, meaning callers who stored image paths as gs:// strings (e.g. retrieved from Firestore) had to manually convert them before loading. StringLoader eliminates that conversion by intercepting any string starting with gs:// and delegating to the existing FirebaseStorageFetcher.

Usage

Register StringLoader.Factory alongside the existing loader in your AppGlideModule:

@GlideModule
public class MyAppGlideModule extends AppGlideModule {

    @Override
    public void registerComponents(Context context, Glide glide, Registry registry) {
        registry.append(StorageReference.class, InputStream.class,
                new FirebaseImageLoader.Factory());
        registry.append(String.class, InputStream.class,
                new FirebaseImageLoader.StringLoader.Factory());
    }
}

You can then pass a gs:// URL string directly to Glide:

GlideApp.with(context)
        .load("gs://my-bucket.appspot.com/images/photo.png")
        .into(imageView);

Preview

Screenshot_1781696578

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for loading images directly from a gs:// URL string in Glide, including documentation updates in the README and the implementation of StringLoader in FirebaseImageLoader.java. The reviewer suggested improving the flexibility and testability of StringLoader by allowing it to accept a custom FirebaseStorage instance, as well as catching IllegalStateException to handle initialization edge cases gracefully.

@demolaf demolaf marked this pull request as ready for review June 17, 2026 11:54
@demolaf demolaf requested a review from just1and0 June 17, 2026 12:03

@just1and0 just1and0 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Nice work with this one!

@demolaf demolaf merged commit e4134b1 into master Jun 17, 2026
18 checks passed
@github-project-automation github-project-automation Bot moved this from Backlog to Done in studio-2394994192-60a69 Jun 17, 2026
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.

GlideException: Failed to load resource

2 participants