Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- Fixed folders showing up incorrectly as files in copy/move dialog ([#267])
- Fixed filename error in Save As-Dialog ([#50])
Comment thread
jguegel marked this conversation as resolved.
Outdated

## [1.2.3] - 2025-09-15
### Fixed
Expand Down Expand Up @@ -74,6 +75,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[#176]: https://github.com/FossifyOrg/File-Manager/issues/176
[#251]: https://github.com/FossifyOrg/File-Manager/issues/251
[#267]: https://github.com/FossifyOrg/File-Manager/issues/267
[#250]: https://github.com/FossifyOrg/File-Manager/issues/250

Comment thread
jguegel marked this conversation as resolved.

[Unreleased]: https://github.com/FossifyOrg/File-Manager/compare/1.2.3...HEAD
[1.2.3]: https://github.com/FossifyOrg/File-Manager/compare/1.2.2...1.2.3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ class SaveAsActivity : SimpleActivity() {
}

val source = intent.getParcelableExtra<Uri>(Intent.EXTRA_STREAM)!!
val filename = getFilenameFromContentUri(source)
val originalFilename = getFilenameFromContentUri(source)
?: source.toString().getFilenameFromPath()
val filename = sanitizeFilename(originalFilename)
val mimeType = contentResolver.getType(source)
?: intent.type?.takeIf { it != "*/*" }
?: filename.getMimeType()
Expand Down Expand Up @@ -66,4 +67,9 @@ class SaveAsActivity : SimpleActivity() {
super.onResume()
setupToolbar(binding.activitySaveAsToolbar, NavigationIcon.Arrow)
}

fun sanitizeFilename(filename: String): String {
Comment thread
jguegel marked this conversation as resolved.
Outdated
return filename.replace("[/\\\\<>:\"|?*\u0000-\u001F]".toRegex(), "_")
.takeIf { it.isNotBlank() } ?: "unnamed_file"
}
}
Loading