Skip to content

Commit a7351b0

Browse files
benjaminRomanofalhassen
authored andcommitted
Avoid referencing resource names within Resource Loader
1 parent acced70 commit a7351b0

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

library/src/main/java/com/bumptech/glide/load/model/ResourceLoader.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@ private Uri getResourceUri(Integer model) {
5252
+ "://"
5353
+ resources.getResourcePackageName(model)
5454
+ '/'
55-
+ resources.getResourceTypeName(model)
56-
+ '/'
57-
+ resources.getResourceEntryName(model));
55+
+ model);
5856
} catch (Resources.NotFoundException e) {
5957
if (Log.isLoggable(TAG, Log.WARN)) {
6058
Log.w(TAG, "Received invalid resource id: " + model, e);

library/test/src/test/java/com/bumptech/glide/load/model/ResourceLoaderTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void setUp() {
4949
@Test
5050
public void testCanHandleId() {
5151
int id = android.R.drawable.star_off;
52-
Uri contentUri = Uri.parse("android.resource://android/drawable/star_off");
52+
Uri contentUri = Uri.parse("android.resource://android/" + String.valueOf(id));
5353
when(uriLoader.buildLoadData(eq(contentUri), anyInt(), anyInt(), any(Options.class)))
5454
.thenReturn(new ModelLoader.LoadData<>(key, fetcher));
5555

0 commit comments

Comments
 (0)