Skip to content
Draft
Changes from all 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
22 changes: 13 additions & 9 deletions src/main/kotlin/html4tree/main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -351,16 +351,20 @@ fun process_ignore_file(curr_dir: File, dirFilesNames: Array<String>? = null): S

// 보안 향상: dot-like prefixes and case variants of known sensitive names are excluded.
(dirFilesNames ?: curr_dir.list())?.forEach {
val normalizedName = it.toLowerCase(java.util.Locale.ROOT)
if (
it.isHiddenFile() ||
normalizedName in Constants.defaultSensitiveFileNamesLowercase ||
normalizedName.endsWith("~") ||
Constants.defaultSensitiveExtensions.any { extension ->
normalizedName.endsWith(extension)
}
) {
if (it.isHiddenFile() || it.endsWith("~")) {
files_to_exclude.add(it)
} else {
// ⚡ Bolt Performance Optimization: Defer expensive string allocation
// (toLowerCase) until after evaluating cheap, short-circuiting properties.
val normalizedName = it.toLowerCase(java.util.Locale.ROOT)
if (
normalizedName in Constants.defaultSensitiveFileNamesLowercase ||
Constants.defaultSensitiveExtensions.any { extension ->
normalizedName.endsWith(extension)
}
) {
files_to_exclude.add(it)
}
}
}

Expand Down
Loading