Skip to content

Commit 2e92f75

Browse files
authored
Replace invalid characters with underscore in caching (#6358)
1 parent 32f04fc commit 2e92f75

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Source/SwiftLintFramework/Configuration/Configuration+Remote.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ internal extension Configuration.FileGraph.FilePath {
200200
}
201201

202202
private func filePath(for urlString: String, rootDirectory: String) -> String {
203-
let adjustedUrlString = urlString.replacingOccurrences(of: "/", with: "_")
203+
let invalidCharacters = [":", "<", ">", "\"", "/", "\\", "|", "?", "*"]
204+
var adjustedUrlString = urlString
205+
for char in invalidCharacters {
206+
adjustedUrlString = adjustedUrlString.replacingOccurrences(of: char, with: "_")
207+
}
208+
adjustedUrlString = adjustedUrlString.trimmingCharacters(in: CharacterSet(charactersIn: "."))
204209
let path = Configuration.FileGraph.FilePath.versionedRemoteCachePath + "/\(adjustedUrlString).yml"
205210
return path.bridge().absolutePathRepresentation(rootDirectory: rootDirectory)
206211
}

0 commit comments

Comments
 (0)