Skip to content

Commit ec02dba

Browse files
committed
Preserve modified date when unzip files.
1 parent b302495 commit ec02dba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515

1616
- Fixed accidental rendering of pull-to-refresh indicator ([#27])
1717
- Pull-to-refresh setting is now applied as expected ([#136])
18+
- Preserve modified date when unzip files ([#176])
1819

1920
## [1.0.1] - 2024-03-17
2021

@@ -43,3 +44,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4344

4445
[#27]: https://github.com/FossifyOrg/File-Manager/issues/27
4546
[#136]: https://github.com/FossifyOrg/File-Manager/issues/136
47+
[#176]: https://github.com/FossifyOrg/File-Manager/issues/176

app/src/main/kotlin/org/fossify/filemanager/activities/DecompressActivity.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,9 @@ class DecompressActivity : SimpleActivity() {
171171
continue
172172
}
173173

174-
val isVulnerableForZipPathTraversal = !File(newPath).canonicalPath.startsWith(parent)
174+
val outputFile = File(newPath)
175+
176+
val isVulnerableForZipPathTraversal = !outputFile.canonicalPath.startsWith(parent)
175177
if (isVulnerableForZipPathTraversal) {
176178
continue
177179
}
@@ -187,6 +189,7 @@ class DecompressActivity : SimpleActivity() {
187189
fos!!.write(buffer, 0, count)
188190
}
189191
fos!!.close()
192+
outputFile.setLastModified(entry.lastModifiedTimeEpoch)
190193
}
191194

192195
toast(R.string.decompression_successful)

0 commit comments

Comments
 (0)