bumptech / bumptech/glide

Glide load fail when url contain "#"?

Open
#5,134 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

### code

``` kotln
val asset = Uri.parse("file://$name")
Glide.with(context).asBitmap().load(asset).listener(object : RequestListener {
override fun onLoadFailed(
e: GlideException?,
model: Any,
target: Target,
isFirstResource: Boolean
): Boolean {
response.onResult(PowerImageResult.genFailRet("Native加载失败: " + if (e != null) e.message else "null"))
return true
}

override fun onResourceReady(
resource: Bitmap?,
model: Any,
target: Target,
dataSource: DataSource,
isFirstResource: Boolean
): Boolean {
response.onResult(PowerImageResult.genSucRet(resource))
return true
}
}).submit(
if (request.width <= 0) Target.SIZE_ORIGINAL else request.width,
if (request.height <= 0) Target.SIZE_ORIGINAL else request.height
)
```
### Result

``` dart

W/Glide (17285): Load failed for [file:///data/user/0/com.wawavenet.walang/app_flutter/storage_group_avatar_@TGS#_@TGS#cJLOEIIM62CK_4.png] with dimensions [-2147483648x-2147483648]
W/Glide (17285): class com.bumptech.glide.load.engine.GlideException: Failed to load resource
W/Glide (17285): There were 3 root causes:
W/Glide (17285): java.io.FileNotFoundException(/data/user/0/com.wawavenet.walang/app_flutter/storage_group_avatar_@TGS: open failed: ENOENT (No such file or directory))
2
W/Glide (17285): java.io.FileNotFoundException(open failed: ENOENT (No such file or directory))
W/Glide (17285): call GlideException#logRootCauses(String) for more detail
W/Glide (17285): Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class java.io.InputStream, LOCAL
W/Glide (17285): There was 1 root cause:
W/Glide (17285): java.io.FileNotFoundException(/data/user/0/com.wawavenet.walang/app_flutter/storage_group_avatar_@TGS: open failed: ENOENT (No such file or directory))
W/Glide (17285): call GlideException#logRootCauses(String) for more detail
W/Glide (17285): Cause (1 of 1): class java.io.FileNotFoundException: /data/user/0/com.wawavenet.walang/app_flutter/storage_group_avatar_@TGS: open failed: ENOENT (No such file or directory)
W/Glide (17285): Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.os.ParcelFileDescriptor, LOCAL
W/Glide (17285): There was 1 root cause:
W/Glide (17285): java.io.FileNotFoundException(open failed: ENOENT (No such file or directory))
W/Glide (17285): call GlideException#logRootCauses(String) for more detail
W/Glide (17285): Cause (1 of 1): class java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
W/Glide (17285): Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Fetching data failed, class android.content.res.AssetFileDescriptor, LOCAL
W/Glide (17285): There was 1 root cause:
W/Glide (17285): java.io.FileNotFoundException(open failed: ENOENT (No such file or directory))
W/Glide (17285): call GlideException#logRootCauses(String) for more detail
W/Glide (17285): Cause (1 of 1): class java.io.FileNotFoundException: open failed: ENOENT (No such file or directory)
W/Glide (17285): Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{StringUri->Bitmap->Bitmap}, LOCAL
W/Glide (17285): Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{StringUri->Bitmap->Bitmap}
```

Contributor guide

Open the contributing guide

Research direction

Reproduce the failure using the shown Uri.parse("file://$name") and Glide.with(context).load(asset) call with a filename containing #. Inspect how the file URI is interpreted, then verify that the complete path is used and the image loads successfully instead of truncating the filename at #.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.