diff --git a/Sources/Services/ContainerAPIService/Client/Parser.swift b/Sources/Services/ContainerAPIService/Client/Parser.swift index ef209df5c..0dbf38972 100644 --- a/Sources/Services/ContainerAPIService/Client/Parser.swift +++ b/Sources/Services/ContainerAPIService/Client/Parser.swift @@ -368,7 +368,7 @@ public struct Parser { } var directives = defaultDirectives for part in parts { - let keyVal = part.split(separator: "=", maxSplits: 2) + let keyVal = part.split(separator: "=", maxSplits: 1) var key = String(keyVal[0]) var skipValue = false switch key { diff --git a/Tests/ContainerAPIClientTests/ParserTest.swift b/Tests/ContainerAPIClientTests/ParserTest.swift index 0dcc6f7cf..4ff6df4c6 100644 --- a/Tests/ContainerAPIClientTests/ParserTest.swift +++ b/Tests/ContainerAPIClientTests/ParserTest.swift @@ -457,6 +457,26 @@ struct ParserTest { } } + @Test + func testMountBindSourceContainingEquals() throws { + let tempDir = FileManager.default.temporaryDirectory.appendingPathComponent("test-bind-eq-\(UUID().uuidString)=v1") + try FileManager.default.createDirectory(at: tempDir, withIntermediateDirectories: true) + defer { + try? FileManager.default.removeItem(at: tempDir) + } + + let result = try Parser.mount("type=bind,src=\(tempDir.path),dst=/foo") + + switch result { + case .filesystem(let fs): + #expect(fs.source == tempDir.path) + #expect(fs.destination == "/foo") + #expect(!fs.isVolume) + case .volume: + #expect(Bool(false), "Expected filesystem mount, got volume") + } + } + @Test func testMountVolumeValidName() throws { let result = try Parser.mount("type=volume,src=myvolume,dst=/data")