Skip to content

Commit 0e267f1

Browse files
committed
Preserve modified date when unzip files.
1 parent 626497a commit 0e267f1

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

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

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Preserve modified date when unzip files ([#176])
13+
1014
## [1.1.0] - 2025-05-21
1115

1216
### Added
@@ -66,3 +70,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6670
[#120]: https://github.com/FossifyOrg/File-Manager/issues/120
6771
[#149]: https://github.com/FossifyOrg/File-Manager/issues/149
6872
[#150]: https://github.com/FossifyOrg/File-Manager/issues/150
73+
[#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)