             }
             return data
         } else if !consumed {
-            return Data(buffer: unknown)
+            let raw = try scanner.getRawField()
+            return Data(buffer: raw)
         } else {
             return nil
         }

    }

    mutating func asProtobufUnknown(protoFieldNumber: Int) throws -> Data? {
        return consumed ? nil : Data(buffer: unknown)
    }
}

private struct FieldWireTypeLengthDelimited: ProtobufFieldDecoder {
    let buffer: UnsafeBufferPointer<UInt8>
    let unknown: UnsafeBufferPointer<UInt8>
    let scanner: ProtobufScanner
    var consumed = false
    var unknownOverride: Data?

    init(buffer: UnsafeBufferPointer<UInt8>, unknown: UnsafeBufferPointer<UInt8>, scanner: ProtobufScanner) {
        self.buffer = buffer
        self.unknown = unknown
        self.scanner = scanner
    }


        switch scanner.fieldWireFormat {
        case .varint:
            let value = try getVarint()
            return FieldWireTypeVarint(varint: value, scanner: scanner)
        case .fixed64:
            let value = try getFixed8()
            return FieldWireTypeFixed64(fixed8: value, scanner: scanner)
        case .lengthDelimited:
            let value = try getBytesRef()
            return FieldWireTypeLengthDelimited(buffer: value, scanner: scanner)
        case .startGroup:
            return FieldWireTypeStartGroup(scanner: scanner, protoFieldNumber: fieldNumber)
        case .endGroup:
            throw DecodingError.malformedProtobuf
        case .fixed32:
            let value = try getFixed4()
            return FieldWireTypeFixed32(fixed4: value, scanner: scanner)
        }
    }

