Skip to content

Commit c70b7b6

Browse files
committed
fix: Error thrown when % is part of the filename
1 parent 6f61187 commit c70b7b6

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ and this project attempts to adhere to [Semantic Versioning](https://semver.org/
77

88
## [Unreleased]
99

10+
### 🛠️ Fixes
11+
12+
- Error thrown when trying to read metadata from a file that contains a `%` in its filename.
13+
- If we had `%20` in the filename, it'll get incorrectly decoded to a space (` `), resulting in the file not being found.
14+
1015
## [0.7.3] - 2025-02-06
1116

1217
### ⚡ Changes

android/src/main/java/com/cyanchill/missingcore/metadataretriever/Utils.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,11 @@ fun getPercentageRating(rating: Rating?): Double? = when (rating?.isRated()) {
109109
else -> null
110110
}
111111

112-
/** Returns a string that safely handles special characters such as "?" and "#". */
112+
/** Returns a string that safely handles special characters such as "%", "?", and "#". */
113113
fun getSafeUri(uri: String): String {
114-
return uri.replace("?", "%3F").replace("#", "%23")
114+
// It's important to replace the "%" first as if we put it later on, it'll
115+
// break the decoding for "?" & "#".
116+
return uri.replace("%", "%25").replace("?", "%3F").replace("#", "%23")
115117
}
116118

117119
/**

0 commit comments

Comments
 (0)