Commit 6e3dfb5
Use removePrefix instead of replace for multi-release prefix removal (#1972)
`String.replace` replaces all occurrences of the substring, not just the leading one. For multi-release JAR paths, only the leading `META-INF/versions/<n>/` prefix should be stripped before relocation.
- **`ShadowCopyAction.kt`**: Replace `path.replace(multiReleasePrefix, "")` with `path.removePrefix(multiReleasePrefix)` to correctly strip only the leading prefix.
```kotlin
// Before
val newPath = path.replace(multiReleasePrefix, "")
// After
val newPath = path.removePrefix(multiReleasePrefix)
```
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Goooler <10363352+Goooler@users.noreply.github.com>1 parent 49f8c31 commit 6e3dfb5
File tree
1 file changed
+2
-2
lines changed- src/main/kotlin/com/github/jengelman/gradle/plugins/shadow/tasks
1 file changed
+2
-2
lines changedLines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
181 | | - | |
| 180 | + | |
| 181 | + | |
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
| |||
0 commit comments